Visual studio 2010 optional parameter

Neeks
Posted by Neeks under C# category on | Views : 2565
We are aware of VB.net and VB optional parameter.

You can also use the optional parameter in C#.

public int Add(int a, int b, int c = 0)
{
return a + b + c;
}


Call
MessageBox.Show(Add(10,20));

MessageBox.Show(Add(10,20,30));

Comments or Responses

Login to post response