Optional Parameter
What are optional parameters
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sunny SharmaPosted Mar 20, 2014, 12:36 AM
Just to add-on, If you're not passing all the parameters, then optional parameters can be passed only after the required parameters.
Instead of posting it here in Q/A forum, you should post it as a blog.
Princy GuptaPosted Mar 20, 2014, 12:04 AM
C# 4.0 has introduced optional parameters for functions and constructors.
Their values don't have to be explicitly specified by the caller. If the parameter has not been specified as an argument by the caller it is given a default value
voidDisplayOutput(string text1, string text2="optional parameter"){Print(text1); Print(text2);}Only last parameter is optional parameter