public class SortFileByDate:IComparer
{
#region IComparerMembers
public int Compare(Report x, Report y)
{
return DateTime.Compare(y.Date, x.Date);
}
#endregion
}
To use it, for example:
ListlistOfObjects = new List ();
listOfObjects.add(New Report("bla",date);
listOfObjects.Sort(new SortFileByDate());
Aucun commentaire:
Enregistrer un commentaire