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?

Était-ce utile?

La 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 )

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top