New features of C# 3.0
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
Auto properties
Auto-implemented properties are another helpful new feature to save us some typing and reduce the potential to introduce bugs.
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.
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)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
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.
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