Introduction

C# 3.0 includes following some great new features.  This article is same as my original c# 3.0 new features post.

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

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

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

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

 

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 

 

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


Conclusion 

This tutorial was created to help you understand the new features of C# 3.0. I Hope u have found this tutorial helpful and interesting. fore more c# tutorials please visit my post here
推荐.NET配套的通用数据层ORM框架:CYQ.Data 通用数据层框架
新浪微博粉丝精灵,刷粉丝、刷评论、刷转发、企业商家微博营销必备工具"