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.
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:
The following matrix shows the relationship between component versions:
C# Version
CLR Version
Framework Version
1.0
1.1
2.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:
Feature
"Cool"
"C# 2005"
"C# 2008"
Generics
X
Aliases
Static classes
Asymmetric Property Accessors
Anonymous Methods
Iterators
Partial Types
Nullable Types
Delegate Inference
Covariance and Contravariance
Captured Variables
Friend Assemblies
#pragma warning
Lambda Expressions
Extension Methods
Implicitly Typed Local Variables
Implicitly Typed Arrays
LINQ Query Expressions
Anonymous Types
Object and Collection Initializers
Auto-Implemented Properties
Partial Methods
Expression Trees
The following matrix indentifies in which Framework version a given significant feature was introduced:
Side-by-Side Execution
Asp.Net Mobile Controls
IPv6 Support
64-Bit Platform Support
C# Edit and Continue Debugging
Click-Once Deployment
Strongly-Typed Application Settings
Windows Workflow Foundation
Windows Presentation Foundation
Windows Communication Foundation
Windows Cardspace
Microsoft AJAX Library
Add-In and Extensibility
Peer-To-Peer Networking
LINQ
HashSet Collection
Windows Forms Support for Asp.Net Membership
Suite B Cryptographic Support
Durable Services
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: