Suppose we have a structure named Attribute that contains the Name and Surname variables. Now we create a list of structures named AttributeList and we want to sorted by Name, then we can do:
var sorted = (from att in AttributeList orderby att.Name ascending select att);
foreach (Attribute att in sorted)
Console.WriteLine(att.Name);
And the same for the case of order by Surname.
I hope this is helpful.
No comments:
Post a Comment