質問

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