Hunt

Showing posts with label Named and nullable Parameters. Show all posts
Showing posts with label Named and nullable Parameters. Show all posts

Monday, May 30, 2011

Optional,Named and Nullable Parameters in .NET

//Optional Parameter-Only in 2010(4.0)
public void a1(int a, int c,int b = 2)
{
}

//named parameters

public void a11(int a, int c=6, int b = 2)
{
}



//without nullable parametrs
int a = 0;
public void dd()
{
a = null;//cant assign to null to int throw error but if we use nullable paramaetrs dont show error
}
//nullable parametrs
int? a = 0;
public void dd()
{
a = null;
}