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. The hope is that anyone failing to find an answer with the wrong version number will find this question and then search again with the right version number.
C# language version history:
These are the versions of C# known about at the time of this writing:
DisposeonIEnumerators which implementedIDisposable. A few other small features.var), and query expressionsdynamic), delegate and interface generic variance, more COM support, named arguments, tuple data type and optional parametersawaitincatchandfinally, extensionAddmethods in collection initializers.outparameter declarations, local functions, binary literals, digit separators, and arbitrary async returns.unmanagedgeneric type constraints.refreassignment. Unsafe improvements:stackallocinitialization, unpinned indexedfixedbuffers, customfixedstatements. Improved overloading resolution. Expression variables in initializers and queries.==and!=defined for tuples. Auto-properties’ backing fields can now be targeted by attributes.newexpressions, target typed??and?), and covariant returns. Minor features: relax ordering ofrefandpartialmodifiers, parameter null checking, lambda discard parameters, nativeints, attributes on local functions, function pointers, static lambdas, extensionGetEnumerator, module initializers, and extending partial.usingdirectives, file-scoped namespace declarations, extended property patterns, const interpolated strings, mixed assignment and declaration in deconstruction, async method builders (via attributes) for individual methods, theCallerArgumentExpressionattribute for parameters, enhanced#linepragmas.Span<char>on a constant string, extended nameof scope, numericIntPtr, UTF-8 string literals, required members,reffields andscoped ref, raw string literals, improved method group conversion to delegate, warning wave 7, generic attributes, newlines in string interpolation expressions, list patternsref readonlyparameters, alias any type,Experimentalattribute, interceptorsIn response to the OP’s question:
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 introducing CLR 4.0, service packs notwithstanding. The CLR in .NET 4.5 has various improvements, but the versioning is unclear: in some places it may be referred to as CLR 4.5 (this MSDN page used to refer to it that way, for example), but the
Environment.Versionproperty still reports 4.0.xxx.As of May 3, 2017, the C# Language Team created a history of C# versions and features on their GitHub repository: Features Added in C# Language Versions. There is also a page that tracks upcoming and recently implemented language features.