I have a simple class that I add to a list, and once I have everything added I want to sort by GridFieldOrder, this should be simple but I’m not able to put it together.
List<UserSearchSetupReOrderIng> UserSearchSetupOmega = new List<UserSearchSetupReOrderIng>();
class UserSearchSetupReOrderIng
{
public string UID { get; set; }
public string Name { get; set; }
public int GridFieldOrder { get; set; }
public string Column { get; set; }
}
So basically if I have 100 items in my list, I just want to sort all of them by GridFieldOrder in order of lowest to highest value. How do I do that?
The
OrderByextension method should do the trick.http://msdn.microsoft.com/en-us/library/bb534966.aspx
for ascending order. (
OrderByDescendingfor descending order.)