Open Menu dzosoft
Close Menu dzosoft




Publish perfectly-optimized content in 1-click


C# Version 4.0


C# Version 4.0

Released April, 2010

C# version 4.0, released with Visual Studio 2010, would have had a difficult time living up to the groundbreaking status of version 3.0. This version introduced some interesting new features:

 Dynamic binding
 Named/optional arguments
 Generic covariant and contravariant
 Embedded interop types

Embedded interop types eased the deployment pain of creating COM interop assemblies for your application. Generic covariance and contravariance give you more power to use generics, but they're a bit academic and probably most appreciated by framework and library authors. Named and optional parameters let you eliminate many method overloads and provide convenience. But none of those features are exactly paradigm altering.

The major feature was the introduction of the dynamic keyword. The dynamic keyword introduced into C# version 4.0 the ability to override the compiler on compile-time typing. By using the dynamic keyword, you can create constructs similar to dynamically typed languages like JavaScript. You can create a dynamic x = "a string" and then add six to it, leaving it up to the runtime to sort out what should happen next.

Dynamic binding gives you the potential for errors but also great power within the language.
Leave comment

Save nickname and email in this browser for the next time.

close publicity
Hiding your face is not a solution!