In my project some developer added method that has optional parameter in parameters list:
public static string GeneratetPopupCall(string pageName,bool withEscapeChar = false)
I know that optional parameters are part of C# 4.0. But our project is targeted to .net 3.5. (C# 3.0)
My question is:
Why it compiles if 3.5 doesn't support optional parameters? Why that is no compilation or syntax error?
You are using the 4.0 compiler, targeted at the 3.5 framework.
This compiles to a runtime 2.0 compatible IL.
As long as you use Visual Studio 2010, you can consume optional parameters even with older .NET Frameworks then 4.0.
The more information can find here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With