Why are some C#4 features allowed even when targeting 3.5?

Posted by Greg on Stack Overflow See other posts from Stack Overflow or by Greg
Published on 2010-05-03T20:01:45Z Indexed on 2010/05/03 20:08 UTC
Read the original article Hit count: 195

Filed under:
|

We upgraded to VS 2010, but we haven't yet upgraded to .NET 4.0. All of our projects are still explicitly targeting 3.5.

Today, a developer checked in code that looked like this:

delegate T Generator<out T>();

As far as I know, "in T" and "out T" are C# 4.0 features. According to our build server, which doesn't have .NET 4.0 installed on it, I'm right. The check-in broke the build. But, why the heck does it build on his machine? Why is VS just ignoring the target framework for the project?

Other C# 4.0 features, like the dynamic keyword, do not build on the developer's machine.

© Stack Overflow or respective owner

Related posts about visual-studio-2010

Related posts about c#4.0