Question

Just out of curiosity I was looking at abstract Comparer(T) class source at mscorlib/system/collections/generic/comparer.cs, and it struck me the constructor is missing from the published source. Any idea why?

Was it helpful?

Solution

It's a stateless abstract class (i.e. it has no instance fields), it doesn't need a constructor because there is nothing to initialize.

It will, of course, have a default constructor which is compiler-generated, which any subclass constructor will call, but it will evaluate to call just the Object constructor (which in-turn doesn't really do much: http://referencesource.microsoft.com/#mscorlib/system/object.cs )

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top