Visual Studio 2010 uses C# 4.0. Perhaps what you meant to say was “even if you’re targeting a version of .NET older than 4.0, you can still use C# 4.0 or higher in VS2010”. The C# version and the .NET Framework version are independent and are numbered separately.

 

Because MS dropped support for Windows CE in VS 2010, my workplace is stuck on VS 2008: C# 3.0 and C++03.

 

From: James Athey [mailto:james@apx-labs.com]
Sent: Monday, May 12, 2014 9:01 AM
To: swig-devel
Subject: [Swig-devel] %compactdefaultargs and C#

 

A question for anyone familiar with the implementation of %compactdefaultargs - if I wanted to add support for %compactdefaultargs to C#, how difficult would it be?

 

The documentation currently states that %compactdefaultargs "does not work for the statically typed languages, such as C# and Java, which don't have optional arguments in the language.” As it turns out, C# DOES support default arguments.  The CLR has supported default arguments from the beginning, and C# as a language has supported it explicitly since C# 4.0.  Even if you’re targeting a previous version of C#, as long as you’re using Visual Studio 2010 or later to compile the code (or a recent version of Mono), default arguments will compile in any version of C#.

 

~James

DISCLAIMER: This email may contain confidential and/or privileged information and any rights to confidentiality and/or privilege have not been waived. Please notify us immediately if you have received this message in error.