M
Marcel Müller
Is there a way to sort an IList<T> in place?
The solutions I found imply that you copy the current list to List<T>,
sort it and throw away the current IList<T> by replacing the reference
with a new list.
But this might be a very bad Idea if the IList<T> have been something
else than a simple List<T> before. Furthermore it requires by reference
access to the list parameter.
OK, I could copy the list, sort it, clear the original list and copy the
sorted content back to the original list. Seriously?
Isn't there any generic sort algorithm that can be applied to a generic
interface?
Marcel
The solutions I found imply that you copy the current list to List<T>,
sort it and throw away the current IList<T> by replacing the reference
with a new list.
But this might be a very bad Idea if the IList<T> have been something
else than a simple List<T> before. Furthermore it requires by reference
access to the list parameter.
OK, I could copy the list, sort it, clear the original list and copy the
sorted content back to the original list. Seriously?
Isn't there any generic sort algorithm that can be applied to a generic
interface?
Marcel