Thursday, June 28, 2012

Named Arguments

When invoking a method can you even think of messing up the order of the parameters  ??? YES, you can. ;) Thanks to Named Arguments in C#.
Using these you can specify parameters by a name and supply arguments in an order that differs from order of the parameters in the method signature. The following example helps you to understand this more.

// Method declaration
void NameArgs(int _first,int _second,int _thrid) 
{
...
}
// Method invocation
NameArgs(_third:10,_second:5,_first:3);

1 comment: