Usage of Named Parameters

Satyadevanand
Posted by Satyadevanand under C# category on | Points: 40 | Views : 1323
Another new introduction for Named parameters in c# 4.0

Usage of named Parameters


class Class1
{
static void NamedParams(int i, int j)
{
Console.WriteLine("i=" + i);
Console.WriteLine("j=" + j);
}
static void Main(string[] args)
{
NamedParams(j:20,i:30);//30,10
NamedParams(i:40,j:0);//40,0
NamedParams(70, j:90);//70,90
}
}


NamedParams(j:20,i:30);//30,10
Output:
i=30
j=20
NamedParams(i:40,j:0);//40,0
Output:
i=40
j=0
NamedParams(70, j:90);//70,90
Output:
i=70
j=90

Comments or Responses

Login to post response