Custom Sort Generic List

List<aType> _list = new List<aType>(o[]);
_list.Sort(CompareXAscYDesc);

 private int CompareStatusesXAscYDesc(aType x, aType y)
{
if (x == null && y == null) return 0 //x = y
if (x == null) return -1;  //x<y
if (y == null) return 1; //x>y

if (… x y logic) return 0,1,-1;
}
 

Advertisements

%d bloggers like this: