Is there any way, out of the box, to sort a collection in alphabetical order (using C# 2.0 ?).
Thanks
What sort of collections are we talking about? A List<T>
? ICollection<T>
? Array? What is the type stored in the collection?
Assuming a List<string>
, you can do this:
List<string> str = new List<string>();
// add strings to str
str.Sort(StringComparer.CurrentCulture);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With