Default Parameter in .NET 4(C#)
During my using for the new release .NET 4, I notice that C# support default (Optional) Parameters, after thousands of complains form C# programmer- especially it was supported by VB.NET- now it's available.
Let's create Test function with Optional Parameter
private void TestFunction(string para1, string para2 = "Default") { Response.Write("Parameter one =" + para1 +" , Parameter two="+ para2 ); }
Then, if you try to call this method the Intellisense display likes this:
Therefore,if you don’t pass the second parameter the value of para2 will be “Default”.
With this new future in C#, you can ignore many overload functions event it was acceptable solution!