Tuesday, January 24, 2012

How to use Optional Parameter in C#

We can use optional parameter by the following  way:
Syntax :
We need to set "string Id=""" called as optional parameter
Here "string Id=" is the variable declaration
all the optional parameters should declare after required parameters

private void GetSelectedItems(Label lbltest,string Id="")

//calling function using optional parameter

//calling function without using optional parameter

No comments:

Post a Comment