Freigeben über


C# and .Net Framework Features by Version Quick Reference

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"

Generics

   

X

 

Aliases

   

X

 

Static classes

   

X

 

Asymmetric Property Accessors

   

X

 

Anonymous Methods

   

X

 

Iterators

   

X

 

Partial Types

   

X

 

Nullable Types

   

X

 

Delegate Inference

   

X

 

Covariance and Contravariance

   

X

 

Captured Variables

   

X

 

Friend Assemblies

   

X

 

#pragma warning

   

X

 

Lambda Expressions

     

X

Extension Methods

     

X

Implicitly Typed Local Variables

     

X

Implicitly Typed Arrays

     

X

LINQ Query Expressions

     

X

Anonymous Types

     

X

Object and Collection Initializers

     

X

Auto-Implemented Properties

     

X

Partial Methods

     

X

Expression Trees

     

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

Side-by-Side Execution

 

X

     

Asp.Net Mobile Controls

 

X

     

IPv6 Support

 

X

     

64-Bit Platform Support

   

X

   

C# Edit and Continue Debugging

   

X

   

Click-Once Deployment

   

X

   

Strongly-Typed Application Settings

   

X

   

Windows Workflow Foundation

     

X

 

Windows Presentation Foundation

     

X

 

Windows Communication Foundation

     

X

 

Windows Cardspace

     

X

 

Microsoft AJAX Library

       

X

Add-In and Extensibility

       

X

Peer-To-Peer Networking

       

X

LINQ

       

X

HashSet Collection

       

X

Windows Forms Support for Asp.Net Membership

       

X

Suite B Cryptographic Support

       

X

Durable Services

       

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:

Comments

  • Anonymous
    March 17, 2008
    C# and .NET Framework Features By Version

  • Anonymous
    April 16, 2008
    The comment has been removed

  • Anonymous
    May 29, 2008
    What does CLR 2.0 "updated" mean with regard to .Net 3.5?  The post implies that I can run against .Net 3.5 assemblies on the same CLR as is used to run .Net 2.0 assemblies, but the table impies otherwise.  Is an update to the CLR required to run .Net 3.5 assemblies?  

  • Anonymous
    March 26, 2009
    Professional ASP.NET MVC 1.0; Chapter 1: Nerd Dinner "...walks through how to build a ... complete

  • Anonymous
    July 21, 2009
    Can you give the fetures of C# 1.0

  • Anonymous
    January 06, 2014
    in 1st set linq expression is in 3.0 but in 2nd set linq is in 3.5.. pl let me know which version it belongs