Would like to make sure I understand the concept behind the line of code in the class PersonComparerName:
Code:
public static IComparer Default = new PersonComparerName();
As I understand it - it is for "ease of use" in that it allows a short cut to instantiating an instance of IComparer (based on an instance of PersonComparerName via polymorphism) in this case for use in the line in program.cs:
Code:
list.Sort(PersonComparerName.Default);
One could also eliminate that line (in PersonComparerName above) and then either do something in program.cs like:
Code:
IComparer PersonCompareNameIComparer = new PersonComparerName();
list.Sort(PersonCompareNameIComparer);
or even :
Code:
list.Sort(new PersonComparerName());
(they both seem to work for me anyway).
Thanks for any additional clarification or insights on this.
stuartho