Enable constructor contracts
That would be great to be able to define methods in interfaces as contructors - I mean a way of forcing the implementers to have a constructor matching the one defined in the interface.
Also that would be great to have static interfaces (contracts, which static classes can implement).
52
votes
3 comments
-
Artak Mkrtchyan
commented
Hi Henning.
Sure I can, but that's a pattern, not a language level solution, what I've asked for.
Regards,
Artak -
Henning Dieterichs
commented
You could solve it currently with the abstract factory pattern.
-
Jon
commented
This is the feature I most wish C# had.