How to get the gender of a first name using C# in .NET Framework

Knowing someone’s gender based on their first name can be very useful indeed. It can of great help in determining a person’s title when composing letters or emails, for example. Today, we will be looking at how to to accomplish this identification in the easiest way possible.

First, install the Validate API client using Package Manager:

Install-Package Cloudmersive.APIClient.NET.Validate -Version 1.2.7

Now call NameGetGender and provide it with the name and country code (if possible).

using System;
using System.Diagnostics;
using Cloudmersive.APIClient.NET.Validate.Api;
using Cloudmersive.APIClient.NET.Validate.Client;
using Cloudmersive.APIClient.NET.Validate.Model;
namespace Example
public class NameGetGenderExample
public void main()
// Configure API key authorization: Apikey
Configuration.Default.AddApiKey("Apikey", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Configuration.Default.AddApiKeyPrefix("Apikey", "Bearer");
var apiInstance = new NameApi();
var input = new GetGenderRequest(); // GetGenderRequest | Gender request information
// Get the gender of a first name
GetGenderResponse result = apiInstance.NameGetGender(input);
catch (Exception e)
Debug.Print("Exception when calling NameApi.NameGetGender: " + e.Message );

Your return will include whether it was successful as well as the gender.

Image for post

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store