index sort

Code Example - index sort

                
                        Array.Sort<int>(index, (a,b) => anylist[a].CompareTo(anylist[b]));
// index is the same size as anylist, initialized with 0,1,2,3,... etc.
// The order of elements in anylist is not changed.
// However anylist[index[i]] yields sorted values for i=0,1,2,3,... etc.