In the next recipe, we will see how to call .NET methods that expect interfaces in the arguments.
As an example, we will consider a
Sort method of the generic
Sort method can be called without arguments - in this case, a default comparer for the
<T> type will be used. But there is an overload of Sort accepting an alternative comparer passed through a reference to a class implementing the
public void Sort(IComparer<T> comparer)
We will see how to declare a class implementing a generic interface and pass it to the method. These manipulations with an alternative comparer will allow us to sort with a culture that is different from the system locale.
In this example, a list will ...