views:

585

answers:

2

Question is in title. 3.0 or 4.0?

A: 

Visual Studio 2010 will respect your target. If you set it to 3.5, it'll compile in 3.5.

Echiban
3.5, there's no such version of the C# compiler
Darin Dimitrov
3.5 is a framework version, not the compiler version.
Aen Sidhe
Oops. My bad. Sorry.
Echiban
+5  A: 

It will use the C# 4 compiler, so you can still use (some) C# 4 features.

If you want to restrict yourself to C# 3, click on the Advanced button in the project properties Build tab (bottom right) and you can choose the language version you want to use.

Jon Skeet
@Jon, if it uses the C# 4.0 compiler how it will interpret the `dynamic` keyword when targeting .NET 3.5? I suppose it will generate a compile error as the class is not defined?
Darin Dimitrov
@Darin: I suspect it will give you an error saying that you can't use `dynamic` against .NET 3.5. Try it :)
Jon Skeet
@Jon, wish I could, currently at 58% downloading VS 2010 Ultimate :-)
Darin Dimitrov
Did I undestand you correctly: even if I restrict myself by a language version option, it'll be compiled by 4.0 compiler but with additional restrictions?
Aen Sidhe
@Aen: Yes. This is like specifying the /langversion flag on the command line.
Jon Skeet