Wednesday, May 19, 2010

CSharp 4.0 New Features

Dynamic binding

Dynamic binding allows you to write method, operator and indexer calls, property and field accesses, and even object invocations which bypass the C# static type checking and instead gets resolved at runtime.

To practice example follow the link

http://www.dotnetspark.com/kb/1206-overview-dynamic-type-c-sharp-40.aspx

Named and optional arguments

Parameters in C# can now be specified as optional by providing a default value for them in a member declaration. When the member is invoked, optional arguments can be omitted. Furthermore, any argument can be passed by parameter name instead of position.

To Read more info visit below link

http://cherupally.blogspot.com/2009/11/c-40-new-features-named-and-optional.html

COM specific interop features

Dynamic binding as well as named and optional arguments help making programming against COM less painful than today. On top of that, however, we are adding a number of other features that further improve the interop experience specifically with COM.

Variance

It used to be that an IEnumerable string wasn’t an IEnumerable object. Now it is – C# embraces type safe “co-and contravariance,” and common BCL types are updated to take advantage of that.

Refer below link for code sample explanation

http://andersnoras.com/post/100795246/c-4-0-covariance-and-contra-variance

No comments:

Post a Comment

Followers

Contributors