Today I first used the sort method of ArrayList in C # In order to sort the data under my business logic I designed a class inherit the IComparer interface, then I realized the method -. Compare of the interface, in which I coded some logic to Compare Two Objects And Return A Value Indication WHETER One is Less Than, Equal Toor Greater Than The Other.There Is A Simple Sample Here
ArrayList Myal
=
New
ArrayList (); myal.add (
"
THE
"
); Myal.add
"
Quick
"
); Myal.add
"
Brown
"
IComparer mycomparer
=
New
mycompare (); myal.sort
0
,
3
Mycomparer;
public
Class
Mycompare: iComparer
{ICOMPARER.COMPARE (Object X, Object Y) {Return ((New CaseInSensitiveComparer ()). Compare (Y, X));}}
I Think The Sort Way of Arraylist Designed In C # is Great, We Can Sort The Elements in Any Way We Want