Archive for the ‘C# 4.0’ Category

Optional and Named Paramters

Posted: September 27, 2010 in C# 4.0
Tags: , ,

Salam Alikom, Optional Paramters: A parameter is optional if it specifies a default value in its declaration: void Foo (int x = 23) { Console.WriteLine (x); } Optional parameters may be omitted when calling the method: Foo(); // 23 The default argument of 23 is actually passed to the optional parameter x—the compiler bakes the [...]