Pregunta

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?

¿Fue útil?

Solución

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 )

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top