c# - How to avoid implementing empty constructors in derived classes? -


i have base class has large number of derived classes, , base class has several constructors. in derived classes have implement empty constructors forward arguments base constructors. possible somehow tell c# use derived constructors?

for example, if using base class.

 class basetool  {       public basetool(string arg1, string arg2)       {           // stuff.       }        public basetool(string arg1)       {           // stuff.       }        public basetool(int arg1)       {           // stuff.       }   } 

i have implement above constructors arguments, , call : base(...) forward them derived class. resulting in lot of classes have empty constructors. seems lot of wasted code.

constructors not inherited base classes, there no way around declaring constructors in each derived class. however, automate repetitive task with, example, t4 templates.


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo