Click here to Skip to main content
Licence CPOL
First Posted 4 Jun 2011
Views 6,640
Bookmarked 8 times

New features of C# 3.0

By | 7 Jun 2011 | Article
New features available in the C# 3.0

Introduction

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

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


Related article

Please go through my post on c# 4.0 new features for more information :-)

History

  • Added C# 4.0 new features reference added   - 06-June-2011
  • Posted - 04-June-2011

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

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

A Mahesh

Web Developer

India India

Member

Follow on Twitter Follow on Twitter
Symphony Services, Banglore, 560 087, India

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
General[My vote of 1] too little too late PinmemberCIDev9:08 8 Jun '11  
GeneralMy vote of 1 PinmemberMarcus Kramer7:50 8 Jun '11  
GeneralMy vote of 1 Pinmemberdarthrevenant20:26 7 Jun '11  
GeneralWhy I did not vote. PinmentorKeith Barrow9:13 7 Jun '11  
GeneralMy vote of 1 PinmemberSelvin3:37 7 Jun '11  
GeneralWhy .NET 2 PinmvpPete O'Hanlon2:42 7 Jun '11  
GeneralMy vote of 1 PinmemberNagy Vilmos1:43 6 Jun '11  
GeneralRe: My vote of 1 PinmemberA Mahesh16:39 6 Jun '11  
GeneralMy vote of 2 PinmemberAdrian Pasik23:30 5 Jun '11  
GeneralRe: My vote of 2 PinmemberA Mahesh16:35 6 Jun '11  
GeneralWAY too late with this one PinmvpDave Kreskowiak4:37 5 Jun '11  
GeneralRe: WAY too late with this one PinmemberA Mahesh16:36 6 Jun '11  
GeneralRe: WAY too late with this one PinmvpDave Kreskowiak16:51 6 Jun '11  
GeneralIn which generation are you living? PinmvpKunal_Chowdhury4:16 5 Jun '11  
GeneralRe: In which generation are you living? PinmemberMember 183883111:14 5 Jun '11  
GeneralRe: In which generation are you living? Pinmemberjim lahey0:38 6 Jun '11  
GeneralRe: In which generation are you living? PinmvpPete O'Hanlon2:38 7 Jun '11  
GeneralRe: In which generation are you living? PinmemberA Mahesh16:37 6 Jun '11  
General[My vote of 2] Really interesting idea... PinmemberKubajzz21:14 4 Jun '11  
JokeRe: [My vote of 2] Really interesting idea... PinmvpKunal_Chowdhury4:17 5 Jun '11  
GeneralRe: [My vote of 2] Really interesting idea... PinmemberMember 183883111:11 5 Jun '11  
GeneralRe: [My vote of 2] Really interesting idea... PinmvpKunal_Chowdhury12:56 5 Jun '11  
GeneralLinq Example PinmemberGeorge Swan20:27 4 Jun '11  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web04 | 2.5.120517.1 | Last Updated 7 Jun 2011
Article Copyright 2011 by A Mahesh
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid