returnList.Sort(delegate(IMyClass x, IMyClass y)
{
return String.Compare(x.Name, y.Name);
});
So, instead of override the ICompare, you can use this short-cut to return a sorted list.
Here is how to just make your Thing class implement IComparable
public int CompareTo(Thing other)
{
return Name.CompareTo(other.Name);
}
No comments:
Post a Comment