In c# 4 and above you can specify default values for parameters, so it’s not necessary to specify them at the call site:
public void DoIt(string text = "")
{
//do something with text
//do other things
}
and then you can call it either passing a parameter, like this:
DoIt("parameterValue");
or without passing a parameter, in which case, the value specified in the method definition will be used:
DoIt(); // equivalent to DoIt("");
3
solved Default method parameters [closed]