In C# (provided it's V4 or above) you can provide optional arguments:
public int Sum(int a, int b, int c = 0)
{
...
And it'll work fine.
Or, you could use the
params
keyword:
public int Sum (params int[] vars)
{
int sum = 0;
foreach (int i in vars)
{
sum += i;
...
You can then call it with one or more values:
sum = Sum(7);
sum = Sum(1, 2, 3, 4, 5, 6, 7, 8, 9);