There\'s no Sort()
function for IList
. Can someoene help me with this?
I want to sort my own IList.
Suppose this is my IList:
For explanation why not to use OrderBy or similar check Christophe's answer.
Here is one attempt to make fast Sort:
public static void Sort(this IList ilist)
{
switch(ilist)
{
case List lst:
lst.Sort();
break;
case Array arr:
Array.Sort(arr);
break;
default:
throw new NotImplementedException();
// or add slow impl if you don't want this to fail!!
}
}