Question is in title. 3.0 or 4.0?
views:
585answers:
2
A:
Visual Studio 2010 will respect your target. If you set it to 3.5, it'll compile in 3.5.
Echiban
2010-04-13 07:30:25
3.5, there's no such version of the C# compiler
Darin Dimitrov
2010-04-13 07:32:40
3.5 is a framework version, not the compiler version.
Aen Sidhe
2010-04-13 08:26:15
Oops. My bad. Sorry.
Echiban
2010-04-19 06:32:23
+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
2010-04-13 07:33:54
@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
2010-04-13 07:35:44
@Darin: I suspect it will give you an error saying that you can't use `dynamic` against .NET 3.5. Try it :)
Jon Skeet
2010-04-13 07:37:54
@Jon, wish I could, currently at 58% downloading VS 2010 Ultimate :-)
Darin Dimitrov
2010-04-13 07:38:43
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
2010-04-13 08:25:34
@Aen: Yes. This is like specifying the /langversion flag on the command line.
Jon Skeet
2010-04-13 08:37:10