![]() |
VOOZH | about |
dotnet add package Demografix --version 0.1.0
NuGet\Install-Package Demografix -Version 0.1.0
<PackageReference Include="Demografix" Version="0.1.0" />
<PackageVersion Include="Demografix" Version="0.1.0" />Directory.Packages.props
<PackageReference Include="Demografix" />Project file
paket add Demografix --version 0.1.0
#r "nuget: Demografix, 0.1.0"
#:package Demografix@0.1.0
#addin nuget:?package=Demografix&version=0.1.0Install as a Cake Addin
#tool nuget:?package=Demografix&version=0.1.0Install as a Cake Tool
Run demographic analysis over names — predicted gender, age, and nationality — from one client. The official C# package covers genderize.io, agify.io, and nationalize.io.
dotnet add package Demografix
The package targets netstandard2.0, net8.0, and net10.0.
Construct a client, run a batch over a list of names, read the predictions in aggregate, and read the remaining quota.
using System.Linq;
using Demografix;
using var client = new DemografixClient(apiKey: "YOUR_API_KEY");
var names = new[] { "michael", "matthew", "jane" };
var ages = await client.AgifyBatchAsync(names);
// Aggregate the predictions across the list.
var distribution = ages.Results
.Where(r => r.Age.HasValue)
.GroupBy(r => r.Age!.Value / 10 * 10)
.ToDictionary(g => $"{g.Key}s", g => g.Count());
Console.WriteLine(ages.Quota.Remaining); // 24987
The constructor takes a required apiKey and an optional timeout (default ten seconds). The service hosts
and the User-Agent are fixed constants, not options.
An API key is required. Creating one is free and includes 2,500 requests per month. Generate a key in your dashboard at genderize.io, agify.io, or nationalize.io. One key works across all three services.
Predict gender across a list and summarize the split.
using var client = new DemografixClient("YOUR_API_KEY");
var one = await client.GenderizeAsync("peter");
// one.Gender -> "male", one.Probability -> 1.0
var batch = await client.GenderizeBatchAsync(new[] { "peter", "lois", "jane" });
var split = batch.Results
.GroupBy(r => r.Gender ?? "unknown")
.ToDictionary(g => g.Key, g => g.Count());
GenderizePrediction exposes Name, Gender ("male", "female", or null), Probability, Count, and
CountryId.
Predict age across a list and build a distribution.
using var client = new DemografixClient("YOUR_API_KEY");
var one = await client.AgifyAsync("michael");
// one.Age -> 57
var batch = await client.AgifyBatchAsync(new[] { "michael", "matthew", "jane" });
var byDecade = batch.Results
.Where(r => r.Age.HasValue)
.GroupBy(r => r.Age!.Value / 10 * 10)
.ToDictionary(g => $"{g.Key}s", g => g.Count());
AgifyPrediction exposes Name, Age (int or null), Count, and CountryId.
Predict nationality across a list and tally the mix.
using var client = new DemografixClient("YOUR_API_KEY");
var one = await client.NationalizeAsync("nguyen");
// one.Country[0].CountryId -> "VN"
var batch = await client.NationalizeBatchAsync(new[] { "nguyen", "smith", "garcia" });
var mix = batch.Results
.Where(r => r.Country.Count > 0)
.GroupBy(r => r.Country[0].CountryId)
.ToDictionary(g => g.Key, g => g.Count());
NationalizePrediction exposes Name, Country (up to five NationalizeCountry candidates in descending
probability), and Count. NationalizeCountry exposes CountryId and Probability.
GenderizeAsync, GenderizeBatchAsync, AgifyAsync, and AgifyBatchAsync accept an optional countryId
(ISO 3166-1 alpha-2) that scopes the prediction to one country. The server echoes it back uppercase on each
prediction. nationalize does not take this parameter. Pass it on a batch to scope a whole list and summarize
the result in aggregate.
var names = new[] { "kim", "andrea", "jan" };
var batch = await client.GenderizeBatchAsync(names, countryId: "us");
var split = batch.Results
.GroupBy(r => r.Gender ?? "unknown")
.ToDictionary(g => g.Key, g => g.Count());
// batch.Results[0].CountryId -> "US" on every row
Every result and every raised error carries a Quota with three fields read from the rate-limit response
headers. Read it off the returned value or the caught error; it is never cached on the client.
| Field | Meaning |
|---|---|
Limit |
names allowed in the current window |
Remaining |
names left in the current window |
Reset |
seconds until the window resets |
Non-2xx responses throw a typed exception. Transport failures throw TransportException. Every exception
extends DemografixException and carries Status, Message, and Quota (when the headers were present).
| Status | Exception |
|---|---|
| 401 | AuthException |
| 402 | SubscriptionException |
| 422 | ValidationException |
| 429 | RateLimitException |
| other non-2xx | DemografixException |
| network / timeout / non-JSON | TransportException |
A batch of more than ten names throws ValidationException before any HTTP call. A RateLimitException
always carries Quota, so Quota.Reset tells you how long to wait.
try
{
var batch = await client.GenderizeBatchAsync(names);
}
catch (RateLimitException ex)
{
await Task.Delay(TimeSpan.FromSeconds(ex.Quota!.Reset));
// retry
}
| Method | Returns | country_id |
|---|---|---|
GenderizeAsync(name, countryId?) |
GenderizeResult |
yes |
GenderizeBatchAsync(names, countryId?) |
Batch<GenderizePrediction> |
yes |
AgifyAsync(name, countryId?) |
AgifyResult |
yes |
AgifyBatchAsync(names, countryId?) |
Batch<AgifyPrediction> |
yes |
NationalizeAsync(name) |
NationalizeResult |
no |
NationalizeBatchAsync(names) |
Batch<NationalizePrediction> |
no |
A single result exposes the prediction fields plus a Quota. A batch result exposes Results (the per-name
predictions) plus one Quota for the response.
Full API reference: https://genderize.io/documentation/api. One API key works across all three services.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0 | 72 | 6/26/2026 |