Making a Comparer Lambda
See how delegates and lambda expressions can be used to provide flexible sort options.
Interface inheritance allows you to interact with objects over a defined protocol, such as with the IComparable
interface in order to enable the list to sort its contents. This interface has only a single method, and so another possibility is to use a method directly. Explore how we can use the C# delegate type in order to provide a Comparer
that can be used to compare two objects, giving the List the method it needs to sort its contents in different ways.
Download the starter code and resources used in this video.