Arraylist::Sort() by class member
I have an ArrayList which stores different instances of a class, which contains 3 integers. I wish to sort the ArrayList by 1 of these integers. I'm sure it's possible but can't find anything on the internet to show me how, can anyone help?
I know I have to use an interface class using IComparer, but all of my attempts at using this have failed, so I would really appreciate some help!!
At the moment my declaration for this class is:
public interface class DataComparer : public IComparer
int Compare(Object^ lhv, Object^ rhv)
and the usage of it is:
I get the errors:
error C2861: 'int DataComparer::Compare(System::Object ^,System::Object ^)' : an interface member function cannot be defined.
error C3634: 'int DataComparer::Compare(System::Object ^,System::Object ^)' : cannot define an abstract method of a managed class.