Can someone explain to me how this is supposed to work? I followed an MSDN example I found at http://msdn.microsoft.com/en-us/library/234b841s.aspx .
I have made my own CustomObject and have made a Comparer for it.
Here is the CustomObjectComparer
class:
public class CustomObjectComparer : System.Collections.Generic.IComparer<CustomObject>
{
public int Compare(CustomObject co1, CustomObject co2)
{
//Impementation Omitted
}
}
Then when I have a List<CustomObject>
and try to do the following I get compile errors.
List<CustomObject> list = new List<CustomObject>();
CustomObjectComparer comparer = new CustomObjectComparer();
list.Sort(comparer);
Errors:
Argument 1: cannot convert from 'CustomObjectComparer' to 'System.Collections.Generic.IComparer<CustomObject>'
Isn't CustomObjectComparer
a System.Collections.Generic.IComparer
?