I have a List of classes in my collection like
List test = new List();
In my classes I have just some propert
How about:
list.Sort((x,y) => DateTime.Compare(x.date, y.date));
which sorts the existing list, or:
var sorted = list.OrderBy(x=>x.date).ToList();
which creates a second list.
Once you have your classes in your list, and the list is complete:
List<MyClass> testList = new List<MyClass>();
// populate the list...
var orderedList = testList.OrderBy( x => x.date ).ToList();
If you want to sort them in place, you can use List<T>.Sort:
test.Sort( (l,r) => l.date.CompareTo(r.date) );
If you want to sort them into a new result set, LINQ is very nice:
var sortedResults = from mc in test
order by mc.date
select mc;