How to call an overloaded constructors in C#






4.67/5 (3 votes)
All three of the Something methods could be replaced with a single definition of the form:public Something(string name = "default", index = -1){ myName = name; myIndex= index; DoStuff();}
All three of the Something
methods could be replaced with a single definition of the form:
public Something(string name = "default", index = -1)
{
myName = name;
myIndex= index;
DoStuff();
}