kaveer
8/23/2016 - 4:39 PM

Passing Named Arguments

Passing Named Arguments

// By default argument must be in the sam order by which the mthod is declared 
// To pass an argument as a named parameter, you specify the name of the parameter, followed by a colon and the value to use
// Named arguments give you the ability to pass arguments in any order

void optMethod(int firstparam, double second = 0.0, string third = “Hello”)
{
...
}

optMethod(third : “World”, second : 123.45, firstparam : 99);
optMethod(second : 54.321, firstparam : 100);