tags:

views:

7729

answers:

4

What are the correct version numbers for C#? What came out when? Why can't I find any answers about C# 3.5?

[This question is primarily to aid those who are searching for an answer using an incorrect version number, e.g. "C# 3.5". At the time of this writing, there are several questions tagged with "c#3.5". I'm shortly going to correct this, as recommended by the answer to this question about terminology. The hope is that anyone failing to find an answer with the wrong version number will find this answer and then search again with the right version number.]

EDIT: I've now retagged all of the questions marked "c#3.5" to "c#3.0" and "c#4" to "c#4.0" (excluding this one, of course). If those of us who care about this could try to keep an eye out for new questions with those tags, that would be handy :)

+181  A: 

These are the versions of C# known about at the time of this writing:

  • C# 1.0; released with .NET 1.0 and VS2002 (January 2002)
  • C# 1.2 (bizarrely enough); released with .NET 1.1 and VS2003 (April 2003). First version to call Dispose on IEnumerators which implemented IDisposable. A few other small features.
  • C# 2.0; released with .NET 2.0 and VS2005 (November 2005). Major new features: generics, anonymous methods, nullable types, iterator blocks
  • C# 3.0; released with .NET 3.5 and VS2008 (November 2007). Major new features: lambda expressions, extension methods, expression trees, anonymous types, implicit typing (var), query expressions
  • C# 4.0; released with .NET 4.0 and VS2010 (April 2010). Major new features: late binding (dynamic), delegate and interface generic variance, more COM support, named arguments and optional parameters
  • C# 5.0; unknown time frame. Anounced features as of PDC 2010: async programming, metaprogramming.

There is no such thing as C# 3.5 - the cause of confusion here is that the C# 3.0 is present in .NET 3.5. The language and framework are versioned independently, however - as is the CLR, which is at version 2.0 for .NET 2.0 through 3.5, .NET 4.0 introducing CLR 4.0, service packs notwithstanding.

More detailed information about the relationship between the language, runtime and framework versions is available on the C# in Depth site. This includes information about which features of C# 3.0 you can use when targeting .NET 2.0. (If anyone wants to bring all of the content into this wiki answer, they're welcome to.)

Jon Skeet
guess you should give this as the correct answer? good wiki material
dove
@dove: I can't see any way of marking it "correct" presumably because I wrote it. (As you may be able to tell, I wrote it before posting the question - I didn't want anyone else wasting their time with duplicate work.) If it stays the only answer it won't be a problem though :)
Jon Skeet
It could be added that you can use some 3.0 language features when targeting .net 2.0 by using the .net 3.5 compiler. For example, "var" and I believe Lamdas.
Michael Stum
@Michael: There are details of all of that in the link to the C# in Depth site. I'll make that clearer in the link.
Jon Skeet
Jon, what is that metaprogramming about? will you be able to do stuff you can do today with c++ templates?
Johannes Schaub - litb
@litb: No idea. I'm not particularly "up" on metaprogramming, and certainly not what C# 5 might have in that respect.
Jon Skeet
If someone can add dates to that... it would be great!!!
Maxim
@Jon can't you see the matrix now? I think that's metaprogramming :)
Jippers
Added the dates I've got in C# in Depth. I don't think I found out the release dates of VS2002 and VS2003 reliably.
Jon Skeet
(i.e. not the month - the year is right, I think!)
Jon Skeet
Visual Studio 2003 was released for MSDN Subscribers on April 10 or 11, 2003: http://www.heise.de/newsticker/meldung/36071 (German Article, sorry).
Michael Stum
And for 2002 that would be January 16, 2002 (.net 1.0 and Visual Studio .net for MSDN Subscribers), although "official" release was February 13, 2002.
Michael Stum
@Michael: Thanks, fixing.
Jon Skeet
It may seem silly that C# 1.2 was released as such and not as C# 1.1. I think it may have something to do with the fact that in some circles odd numbered minor releases are 'unstable' and even numbered are considered stable. Why some consensus wasn't reached though, I'm sure only Microsoft knows.
Matthew Scharley
@Matthew: I'm not sure that's it, as it was released with .NET 1.1. I have no idea why it was 1.2...
Jon Skeet
extension methods in 2.0
Dercsár
@Dercsar - extension methods are not in C# 2.0. They were first made available as part of .Net 3.5, which is C# 3.0.
Charles Boyung
".Net 3.0" was basically the release of WPF, WCF, WF, etc. wasn't it?
Tim Coker
@Tim: Yes, pretty much so.
Jon Skeet
+8  A: 

The biggest problem when dealing with C#'s version numbers is the fact that it is not tied to a version of the .NET Framework, which it appears to be due to the syncronized releases between Visual Studio and the .NET Framework.

The version of C# is actually bound to the compiler, not the framework. For instance, in VS2008 you can write C# 3.0 and target .NET Framework 2.0, 3.0 and 3.5. The C# 3.0 nomenclature describes the version of the code syntax and supported features in the same way that ANSI C89, C90, C99 describe the code syntax/features for C.

Take a look at Mono, you will see that Mono 2.0 (mostly implemented version 2.0 of the .NET Framework from the ECMA specs) supports the C# 3.0 syntax and features.

Redbeard 0x0A
A: 

hi

VERSION_____LANGUAGE SPECIFICATION______MICROSOFT COMPILER

C# 1.0/1.2____December 2001?/2003?___________January 2002?

C# 2.0_______September 2005________________November 2005?

C# 3.0_______May 2006_____________________November 2006?

C# 4.0_______March 2009 (draft)______________April 2010?

Pramodh
Where did you get a C# 2.0 language specification in December 2002 from? Likewise C# 4 in June 2006? Are you sure you're not talking about ECMA editions, which are completely different?
Jon Skeet
just refer the following linkhttp://en.wikipedia.org/wiki/C_Sharp_(programming_language)
Pramodh
Ah, well, if it's on Wikipedia, it _must_ be right :-)
paxdiablo