Donate to support Ukraine's independence.

10 Mar'11

How to capitalize a word in C#

This can be easily done via TextInfo class:

name = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(name));

Additionally, LINQ can greatly help iterating over a collection:

lst.ForEach(ci => ci.Name = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(ci.Name));
Category: 

Comments