Tuesday, August 10, 2010

Named Parameters with Example

Named Parameters

Named arguments free you from the need to remember or to look up the order of parameters in the parameter lists of called methods. The parameter for each argument can be specified by parameter name.

class Employee

   public void Create(string name, string job="Software Engineer", int salary=50000)

When we calling the above method we can use named parameters feature

obj.Create("Jobin John", salary : 80000);

Hope now it is clear the term Named Parameters.

No comments: