Lets say you have a list of person objects (List
You may use Sort to update the existing list.
[c language=”#”]
personsList.Sort((x, y) => string.Compare(x.Name, y.Name));
[/c]
or OrderBy to produce a new, ordered list.
[c language=”#”]
var newPersonsList = persons.OrderBy(x => x.Name);
[/c]
Leave a Reply