سؤال

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?

هل كانت مفيدة؟

المحلول

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 )

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top