public static void Method(int num, int val = 1)
{
Console.WriteLine(string.Format(“{0}, {1}”, num, val));
}
Above method can be invoked as follows :
Method(1,9);
Method(1);
and the output will be
1,9
1,1
If you dont pass a value do the optional, default parameter, it will take the default value stated in the method decleration.
Recent Comments