Skip to content

Named and Optional Parameters

Mahesh Kumar Alanka

Mahesh Kumar Alanka

Asked Jan 28, 2016, 5:42 PM EST1 answer
Share
LinkedInX
What are the Named and Optional Parameters in C# ?

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • Mahesh Kumar Alanka
    0
    Optional parameters is to simply define extra parameters in an existing function definition, with some default values.it will use the default values that we declared in the function definition.
     
    Named Parameters allow us to call a method without knowing the order of the parameters. 
    A method that are defined using the parameter name followed by a colon and the parameter value. Once you define a method argument as named then no matter what order it is in, the compiler knows what it is and where to use the parameter value in what order. 
    0