Provides authored singular and plural forms of one noun.
public sealed class PluralizationFormsInheritance System.Object → PluralizationForms
Humanizer applies the supported culture's cardinal plural rule to select an authored form. Missing selected forms are not inferred.
Creates a set of authored singular and plural forms.
public PluralizationForms(string singular, string other, string? zero=null, string? one=null, string? two=null, string? few=null, string? many=null);singular System.String
The noun's singular form.
other System.String
The form for the CLDR other category.
zero System.String
The form for the CLDR zero category, or null when unavailable.
one System.String
The form for the CLDR one category, or null when unavailable.
two System.String
The form for the CLDR two category, or null when unavailable.
few System.String
The form for the CLDR few category, or null when unavailable.
many System.String
The form for the CLDR many category, or null when unavailable.
System.ArgumentException
singular or other is empty or whitespace, or an optional supplied form is empty or whitespace.
System.ArgumentNullException
singular or other is null.
Gets the form for the CLDR few category.
public string? Few { get; }Gets the form for the CLDR many category.
public string? Many { get; }Gets the form for the CLDR one category.
public string? One { get; }Gets the form for the CLDR other category.
public string Other { get; }Gets the noun's singular form.
public string Singular { get; }Gets the form for the CLDR two category.
public string? Two { get; }Gets the form for the CLDR zero category.
public string? Zero { get; }Creates forms for a noun that remains unchanged in every cardinal category.
public static Humanizer.PluralizationForms Invariant(string word);word System.String
The invariant word.
PluralizationForms
A form set containing word for every category.
System.ArgumentException
word is empty or whitespace.
System.ArgumentNullException
word is null.
Attempts to pluralize this noun for a quantity using the supported culture's cardinal plural rule.
public bool TryPluralize(decimal quantity, System.Globalization.CultureInfo culture, out string? result);quantity System.Decimal
The quantity. Its encoded decimal scale supplies CLDR visible-fraction operands.
culture System.Globalization.CultureInfo
The supported culture whose cardinal plural rule is applied.
result System.String
The selected authored form when available; otherwise, null.
System.Boolean
true when the selected form is available; otherwise, false.
System.ArgumentNullException
culture is null.
Attempts to resolve one of this noun's exact authored forms to its singular form.
public bool TrySingularize(string form, out string? result);form System.String
An exact authored form.
result System.String
The singular form when form matches; otherwise, null.
System.Boolean
true when form matches an authored form; otherwise, false.
System.ArgumentNullException
form is null.
Matching is Unicode NFC-normalized, ordinal, and case-sensitive.