C# does not have an implementation of optional parameters like those found in php, however you can simulate this feature using method overloading.
static int Add(int a, int b)
{
return Add(a, b, 0, 0);
}
static int Add(int a, int b, int c)
{
return Add(a, b, c, 0);
}
static int Add(int a, int b, int c, int d)
{
return (a + b + c + d);
}
No comments:
Post a Comment