ToPlural

/// <summary>
/// Returns the plural form of the specified word.
/// </summary>
/// <param name="count">How many of the specified word there are. A count equal to 1 will not pluralize the specified word.</param>
/// <returns>A string that is the plural form of the input parameter.</returns>
public static string ToPlural(this string @this, int count = 0)
{
    return count == 1 ? @this : System.Data.Entity.Design.PluralizationServices.PluralizationService.CreateService(new System.Globalization.CultureInfo("en-US")).Pluralize(@this);
}
Example:
"goose".ToPlural(); // returns "geese"
"wolf".ToPlural(); // returns "wolves"

String.Format("{0} {1}", commentCount, "comment".ToPlural(commentCount)); // returns "1 comment" or "2 comments"

Description

Returns the plural form of the specified word.

Details

Double click on the code to select all.

 

;