The Problem
I wanted to be able to add items to a IList<T> but not at the beginning or end of the list—in order based on a sorting function I specified. I could have used List<T>’s Sort() method that takes an IComparer<T> as a parameter, but then I would have to define a new comparer class for every class I wanted to store in the list (not to mention every time I wanted to sort one those types off of a different property).
The Solution
Instead of this potentially bulky solution, I created a generic extension method that will ...