Comparer<T>.Default Property Comparer<T>.Default doesn't use your FooComparer class. It simply returns an instance of the internal class GenericComparer<T>.This class has the constraint that T must implement IComparable<T> so it ca…
/* Author: Jiangong SUN */ I've already written an article introducing the usage of comparer here. In this article I'll compare the usage of IComparable and IComparer with examples. Important difference: A class can have only one Comparable, but mul…
static void Main() { var people = new ArrayList(); people.AddRange(new ArrayList { }, }, }, } }); Console.WriteLine("↓↓↓ Old ↓↓↓"); foreach (Person person in people) { Console.WriteLine($"person name:{person.Name} age:{person.Age}"); }…