Allow to use an inherited constructor
If you inherit from a class you often have to write code where you just create a constructor and call the base class with the same parameters. It would be great, if I could use the constructors of the base class instead.
3 comments
-
Metro Sauper
commented
This would be very improper to do automatically. I guess you could come up with some syntax to allow it to be explicitly specified. It also seems like you are more concerned with the Preamble Xml documentation related to the constructor and not having to duplicate it. It might be more appropriate to have a way in the preamble to indicate you want the specification to be the same as the base class.
-
Anonymous
commented
I know, but if I have about 10 overloads of a constructor I have to write this for every overload just to add one method that can't be implemented as extension method. To have documentation I have at least 3 lines comment per constructor but much more if I want documentation for each parameter. I once overloaded a frameworkclass where I had about 100lines of code and comments for one method .. there must be a better way. If I at least could define with one line, that this constructor of the base class is also useable from the inherited class without the need to copy all the docu, it would by much smaller.
-
Daniel Steiner
commented
I'^m not sure if I understad you correctly but this could be done with a simple one line by using the base keyword to call constructor of base class or this operator if you want to call another constructor within the same class.
See C# language reference or some samples here: http://msdn.microsoft.com/en-us/library/ms173115.aspx