I need an extension method that takes two arguments: a target IList<T> and a custom comparer.
public static void CustomSort<T>( IList<T> target, IComparer<T> comparer )
{
    ...
}
The extension method's job is to arrange target's elements in the order indicated by the custom comparer.
Here are some solutions that won't work:
- The 
List<T>.Sortdoes in-place sorting, which is basically what I'm after. But I can't assume target's concrete type isList<T>. - LINQ offers some solutions but unfortunately they output their results as a new enumerable instead of modifying the target list.
 
Instead, I need the target's Remove and Insert methods to be called to put its elements into the right order.  The target list may be observable so it is important that the solution does not do more removes and inserts than are necessary to obtain the desired order.