C# 4.0?

A

Alain Dekker

How do you tell what version of C# you are using? From online searches it
appears that its not the version of .NET you are targetting but more closely
tied to the IDE.

I am using Visual Studio 2005 at the moment and the Help > About doesn't
tell. From following Google links, it seems VS 2005 uses C# 2 and VS 2008,
uses C# 3, and so on, but it would good if there was some more definitive
way to find out.

Thanks!
Alain
 
A

Arne Vajhøj

How do you tell what version of C# you are using? From online searches it
appears that its not the version of .NET you are targetting but more closely
tied to the IDE.

I am using Visual Studio 2005 at the moment and the Help> About doesn't
tell. From following Google links, it seems VS 2005 uses C# 2 and VS 2008,
uses C# 3, and so on, but it would good if there was some more definitive
way to find out.

Are you asking about the compiler or the language?

The compiler is tied to the .NET version and the .NET version is tied
to the VS version:

..NET VS CSC
1.0 2002 7.0
1.1 2003 7.1
2.0 2005 8.0
3.5 2008 3.5
4.0 2010 4.0

(apparently MS changed numbering scheme between 2005 and 2008)

The language itself has different version numbers:

MS ECMA-334 standard ISO-23270 standard
1.0 2nd Ed 2003 Ed
2.0 4th Ed 2006 Ed
3.0 -
4.0 -

The correlations between compiler and language are as follows:

..NET VS CSC C# version(s)
1.0 & 1.1 2002 & 2003 7.0 & 7.1 1.0
2.0 2005 8.0 1.0 or 2.0 [2.0 is default]
3.5 2008 3.5 1.0 or 2.0 or 3.0 [3.0 is
default]
4.0 2010 4.0 1.0 or 2.0 or 3.0 or 4.0 [4.0
is default]

Sorry to have made a simple question so complex.

Arne
 
A

Alain Dekker

No, the information is great! Thanks for a detailed answer. Its a nice
feature of the later IDEs to be able to run different versions of C# (if you
didn't want to run the latest). Tat might be useful if you had a legacy
project that wouldn't compile (without significant changes) using the C# 4.0
compiler, but would using the C# 2.0 compiler.

Thanks,
Alain

Arne Vajhøj said:
How do you tell what version of C# you are using? From online searches it
appears that its not the version of .NET you are targetting but more
closely
tied to the IDE.

I am using Visual Studio 2005 at the moment and the Help> About doesn't
tell. From following Google links, it seems VS 2005 uses C# 2 and VS
2008,
uses C# 3, and so on, but it would good if there was some more definitive
way to find out.

Are you asking about the compiler or the language?

The compiler is tied to the .NET version and the .NET version is tied
to the VS version:

.NET VS CSC
1.0 2002 7.0
1.1 2003 7.1
2.0 2005 8.0
3.5 2008 3.5
4.0 2010 4.0

(apparently MS changed numbering scheme between 2005 and 2008)

The language itself has different version numbers:

MS ECMA-334 standard ISO-23270 standard
1.0 2nd Ed 2003 Ed
2.0 4th Ed 2006 Ed
3.0 -
4.0 -

The correlations between compiler and language are as follows:

.NET VS CSC C# version(s)
1.0 & 1.1 2002 & 2003 7.0 & 7.1 1.0
2.0 2005 8.0 1.0 or 2.0 [2.0 is default]
3.5 2008 3.5 1.0 or 2.0 or 3.0 [3.0 is
default]
4.0 2010 4.0 1.0 or 2.0 or 3.0 or 4.0 [4.0
is default]

Sorry to have made a simple question so complex.

Arne
 
A

Alain Dekker

Thanks, Peter. Its as I suspected. I am presuming that the core of C# syntax
and functionality remains very consistent between the versions. I do note
that Microsoft are adding in optional parameter support into C# (like
default parameters I'm used to from C++), possibly bowing to pressure from
developers. Would I be correct that developers usually upgrade IDEs more for
the .NET feature enhancements rather than the new C# language features?

Thanks again,
Alain
 
A

Arne Vajhøj

Arne Vajhøj said:
How do you tell what version of C# you are using? From online searches it
appears that its not the version of .NET you are targetting but more
closely
tied to the IDE.

I am using Visual Studio 2005 at the moment and the Help> About doesn't
tell. From following Google links, it seems VS 2005 uses C# 2 and VS
2008,
uses C# 3, and so on, but it would good if there was some more definitive
way to find out.

Are you asking about the compiler or the language?

The compiler is tied to the .NET version and the .NET version is tied
to the VS version:

.NET VS CSC
1.0 2002 7.0
1.1 2003 7.1
2.0 2005 8.0
3.5 2008 3.5
4.0 2010 4.0

(apparently MS changed numbering scheme between 2005 and 2008)

The language itself has different version numbers:

MS ECMA-334 standard ISO-23270 standard
1.0 2nd Ed 2003 Ed
2.0 4th Ed 2006 Ed
3.0 -
4.0 -

The correlations between compiler and language are as follows:

.NET VS CSC C# version(s)
1.0& 1.1 2002& 2003 7.0& 7.1 1.0
2.0 2005 8.0 1.0 or 2.0 [2.0 is default]
3.5 2008 3.5 1.0 or 2.0 or 3.0 [3.0 is
default]
4.0 2010 4.0 1.0 or 2.0 or 3.0 or 4.0 [4.0
is default]

Sorry to have made a simple question so complex.
No, the information is great! Thanks for a detailed answer. Its a nice
feature of the later IDEs to be able to run different versions of C# (if you
didn't want to run the latest). Tat might be useful if you had a legacy
project that wouldn't compile (without significant changes) using the C# 4.0
compiler, but would using the C# 2.0 compiler.

It is not using the old compiler - it is using the new compiler
but telling it to use an old version of the language.

And I would say that it is extremely rare to have the type
of problems you mention.

MS are doing a good job making old code compiler continue
being valid with newer versions of the language.

One of the tricks they apply is that when they add a new
keyword they add it as a contextual keyword. This means that
old code that has used the new keyword as a name actually
still compiles, because the compiler uses the context to determine
whether it is a keyword or a name.

Pretty cool.

The main reason to build with the old language versions is
if you are developing on a new version of VS/.NET, because some projects
require that, but you also need to develop on older projects
using older versions. By specifying the language version you
can ensure that the code will still build in the build environment
(where it will be build with the old versions).

It is also possible to run multiple VS/.NET versions on the
same PC, but many developers quickly become addicted to a new
version of VS.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top