If the goal is to create a generic read-only dictionary that preserves insertion order, can SortedList<,> or SortedDictionary<,> be realiably used with an IComparer<> that attempts to maintain insertion order by doing something similar to the following?
class OrderedComparer<T> : IComparer<M>
{
public int Compare(M x, M y)
{
return x.Equals(y) ? 0 : -1;//or 1
}
}
SortedList<M> orderedList = new SortedList<M>(new OrderedComparer<T>());
(It's interesting that in the case of SortedDictionary, the above method need to return 0 or 1 in order to prevent the elements from being sorted in the reverse insertion order).