Some of the new features in C# 3.0 allow you to write shorter code that is easier to read and maintain. The following code couples have the same results.
- Short syntax for object initialization initialization.
C#
ObjectType objectName = new ObjectType();
objectName.PropertyName = newValue;
objectName.PropertyName2 = newValue2;
C#
ObjectType objectName = new ObjectType(){ PropertyName = newValue, PropertyName2 = newValue2 };
- Syntaxt for anonymous types
C#
SomeVeryLongNameOfType objectName = new SomeVeryLongNameOfType();
C#
var objectName = SomeVeryLongNameOfType();
- Short syntax for collection initialization
C#
CollectionType collectionName = new CollectionType();
collectionName.Add( newItem1 );
..
collectionName.Add( newItemN );
C#
CollectionType collectionName = new CollectionType() { Item1,...,ItemN };
That's it!