Monday, April 7, 2008

C# 3.0 Language enhancements

1) Auto-implemented properties: This feature allows 3.0 compiler that creates anonymous private variables to contain each of the values that the individual property will be using:

for example:

public Int Id {get;set;} none private int _id


2)Implicitly typed local variables:

for example:

var Processes = new List<ProcessData>();

before:
List Processes = new List<ProcessData>()

In this case we no longer have to write the types of local variables twice, The compiler infers the types automatically. This means that even though we use a simplified syntax, we still get alll the benefits fo strong types, such as compile-time validation and IntelliSense.

No comments: