New features of C# 3.0

1.Implicitly typed variables (var)

C# 3.0 supports implicitly typed local variables by making use of a new keyword var. These variables are not typeless; rather, their type is inferred at compile time

csharp-new-features-implicitly-typed-variables.JPG

2.Auto properties

Auto-implemented properties are another helpful new feature to save us some typing and reduce the potential to introduce bugs.

csharp-new-features-auto-properties.JPG

3.Object initialization

C# 3.0 introduces two new features that help when instantiating and initializing object instances. Using object and collection initializers, you can instantiate and initialize either an object or a collection in one compound statement.

csharp-new-fatures-object-initialization.JPG

4.Partial Methods 

C# 2.0 introduced partial class definitions.C# 3.0 adds to that by introducing partial methods. Using partial methods, We can implement the methods in separate file (same partial class)

 csharp-new-fatures-partial-methods.JPG

5.Extension Methods 

Extension methods are one of the most exciting new features.Extension methods enable you to add methods to existing types without creating a new derived type

csharp-new-fatures-extension-methods.JPG

6.LINQ (Language Integrated Query)

The granddaddy of all new C# 3.0 features has to be LINQ, which builds upon all of the new features, especially extension methods, lambda expressions, and anonymous types.You can use LINQ to access data from multiple sources. That means from native object collections, SQL data stores, and XML.

csharp-new-features-linq.JPG

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s