I have a function that takes IList<string> someVariable
as a parameter. I want to convert this to a list so I can sort the values alphabetically.
How do I achieve this?
you can just do
var list = new List<string>(myIList);
list.Sort();
or
var list = myIList as List<string>;
if (list != null) list.Sort; // ...
IList<string> someVariable = GetIList();
List<string> list = someVariable.OrderBy(x => x).ToList();
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