I have a list whose type is string which i want to arrange in ascending order
listCustomFields = new List<String>() { "FirstName", "MiddleName", "Class" };
You can use LINQ OrderBy
method (it will generate new List<string>
with items sorted):
var ordered = listCustomField.OrderBy(x => x).ToList();
or List<T>.Sort
method (it will sort the list in place):
listCustomField.Sort();
use this
listCustomFields.sort();
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