I am working with WPF and encountered a problem about sorting in a List. I find the sample that it use OrderBy( T => T.[the field that refer to it for sorting]) e.g.
List<Contact> contacts = new List<Contact>();
contacts.OrderBy(Contact => Contact.PhoneNumber)
It works perfectly.
However, if I don't know the type and even don't know the field in that type, how should I implement the sorting function?
Like: what should I put in in OrderBy(??? => ????.?????)
In fact, I wanna make a general GridView in which, when user click on one of the header, it will sort the whole list by the corresponding column.
Thank you so much!