description
I noticed a bug in string.ToPlural(). It will pluralize any word ending in "y" with "ies". But that only the case if the letter before the "Y" is a consonants. If the 2nd to last letter is a vowel, just "s" is used (e.g. the plural of "boy" is "boys" not "boies")
//-ies rule
if (singular.EndsWith("y") && "aeiou".IndexOf(singular.Substring(singular.Length-2,1)) == -1)
return singular.Remove(singular.Length - 1, 1) + "ies";
Next, I'm not exactly sure what you want the result of "A of Bs" to be (either "As" or "As of Bs"), but it doesn't do either. It gave "A of Bss". This should correct that (giving "As of Bs"):
// Multiple words in the form A of B : Apply the plural to the first word only (A)
int index = singular.LastIndexOf(" of ");
if (index > 0) return (singular.Substring(0, index).ToPlural()) + singular.Substring(index);
Finally, you forgot the words ending in "x" should be pluralized with "es":
if (singular.EndsWith("x")) return singular + "es";
Previously, "box of balls".ToPlural() gave "box of ballss". With these changes, it gives "boxes of balls"