With few exceptions, developers like using the latest tools and technologies, but are often constrained by the development or production environment. There are many reasons organizations are unwilling or slow to adopt new technology, and these can range from financial to cultural or political. A good developer can survey the landscape, put the success of the project and customer above his own interests, and know when to campaign for change and when to accept constraints. This article will help developers make informed decisions by providing a quick reference of the features that were introduced in each version of the C# language and the .Net Framework.
There are two key questions a .Net application developer must answer at the beginning of any project because of the potential impacts to the development approach and application architecture.
- What version of Visual Studio (or other tools) is available to me?
- What version of the .Net Framework is (or can be) installed on the target machine(s)?
We typically think of .Net versioning in terms of the Framework, "this will be a 2.0 development project," but it is important to understand there are actually three independently versioned components to consider:
- Language (such as C#)
- Common Language Runtime (CLR)
- .Net Framework
The following matrix shows the relationship between component versions:
C# Version | CLR Version | Framework Version |
1.0 | 1.0 | 1.0 |
1.1 | 1.1 | 1.1 |
2.0 | 2.0 | 2.0 3.0 |
| | |
3.0 | 2.0 (updated) | 3.5 |
Before the introduction of .Net 3.0, these components were released as a logical unit, but things got out of sync when the 3.0 Framework did not include a new version of C# or the CLR. For this reason, some think.Net 3.0 should have been released as ".Net 2.5." So what is the 3.0 Framework then? It's a set of libraries (formerly WinFX) that depend on and extend the .Net 2.0 Framework and provide revolutionary technologies such as Windows Communication Foundation (WCF), Windows Workflow Foundation (WF) and Windows Presentation Foundation (WPF).
Developers can exploit the.Net version synchronicity issue by utilizing 3.0 and 3.5 Framework features on a machine that only has the .Net 2.0 Framework installed. Although I am not advocating this technique (especially to circumvent configuration or security controls), it can be accomplished by referencing libraries such as System.Core and using the copy local feature of Visual Studio to deploy selective Framework assemblies with your application without updating the Framework on the target machine. An additional point that should be evidenced from this technique is that language enhancements such as LINQ are actually "syntactic sugar" that can be written using only C# 2.0 code.
The following matrix identifies in which C# version a given significant feature was introduced:
| C# Version | |||
Feature | 1.0 "Cool" | 1.1 | 2.0 "C# 2005" | 3.0 "C# 2008" |
| | X | | |
| | X | | |
| | X | | |
| | X | | |
| | X | | |
| | X | | |
| | X | | |
| | X | | |
| | X | | |
| | X | | |
| | X | | |
| | X | | |
| | X | | |
| | | X | |
| | | X | |
| | | X | |
| | | X | |
| | | X | |
| | | X | |
| | | X | |
| | | X | |
| | | X | |
| | | X |
The following matrix indentifies in which Framework version a given significant feature was introduced:
| Framework Version | ||||
Feature | 1.0 | 1.1 | 2.0 | 3.0 | 3.5 |
| X | | | | |
| X | | | | |
| X | | | | |
| | X | | | |
| | X | | | |
| | X | | | |
| | X | | | |
| | | X | | |
| | | X | | |
| | | X | | |
| | | X | | |
| | | | X | |
| | | | X | |
| | | | X | |
| | | | X | |
| | | | X | |
| | | | X | |
| | | | X | |
| | | | X |
It's not always possible to use the latest tools and technologies. In these situations, it's important for both the developer and the customer to understand what features are affected by these constraints. I hope this article will help with making an informed decision.
References:
- Hyperlinked ECMA C# Language Specification (C# 1.0)
- C# Version 1.1 Specification
- Standard ECMA-334 C# Language Specification (C# 2.0)
- C# Version 3.0 Specification
- C# 3.0 Pocket Reference
- What's New in the .Net Framework 1.1
- What's New in the .Net Framework 2.0
- What's New in the .Net Framework 3.5
- Learn .Net Framework 3.0
- .Net Framework 3.0 Versioning and Deployment Q&A