what are optional parameters in c#?
c#
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.
VulpesPosted Oct 24, 2014, 3:51 PM
For more detail, check this link:
http://msdn.microsoft.com/en-gb/library/dd264739.aspx
aditya shuklaPosted Oct 24, 2014, 4:06 PM
Wim SturkenboomPosted Oct 24, 2014, 3:52 PM
public void MyMethod(string strFirstname, string strLastname)
When calling, you need to pass both parameters
public void MyMethod(string strFirstname, string strLastname="Sturkenboom")
When calling, you ony have to pass the first parameter; second parameter, if omitted in call, is set to a default.