c# - Sort an IList<T> in place -


this question has answer here:

if have list<t>, can sort in place using example

mylist.sort((x,y) => x.mycomparisonmethod(y)); 

if have ilist<t>, can sort new list using

var sortedilist = unsortedilist.orderby(x => x.sortingvalue); 

how can sort ilist<t> in place?

i using c# .net 4.5.1.

write own extension method using arraylist.adapter ilist<t> wrapper , own customcomparer starting comparison delegate:

public static class ilistextensions {     public static void sort<t>(this ilist<t> list, comparison<t> comparison)     {         arraylist.adapter((ilist)list).sort(new customcomparer<t>(comparison));     } } 

Comments

Popular posts from this blog

How to connect android app to App engine -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

php - display validation error message next to the textbox in codeigniter -