by Guest
3/16/2010 1:36:00 PM
BANGALORE, INDIA: This article provides you a head start to the new features in C# 4.0. It also discusses the new features and enhancements to CLR in Microsoft .NET Framework 4.0. The Pre-Requisites It should be noted that CLR 4.0 and C# 4.0 ships with Visual Studio 2010. To work with C# 4.0, you should have Visual Studio 2010 installed in your system. As of this writing, Visual Studio 2010 RC has been released. You can download a copy of Visual Studio 2010 RC from this link: http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx What are the new features in CLR 4.0? The Dynamic Language Runtime Environment (DLR) sits on top of the CLR's managed environment and provides you support for dynamic languages from within the managed environment. So, you can now use dynamically typed languages such as Python, Ruby, and JavaScript from within the managed environment and these can languages can now reside alongside the statically typed .NET languages targeted at the CLR like, C#, Managed C++, and Visual Basic. The components of the DLR include: a .NET language integration layer, a set of runtime code components, and language binders. The DLR provides the following set of services: * Support for Dynamic Method Dispatch * Support for Dynamic Code Generation * Support for a Hosting API C# Language Improvements For more details click here... The four major features included as part of C# 4.0 are: 1.Support for Dynamic Typing and Lookup 2.Support for Named and Optional Parameters 3.Support for Enhanced COM Interop features 4.Support for Variance Support for Dynamic Typing and Lookup Dynamic Lookup is a new feature in C# 4.0 that enables you to eliminate the overhead of casting objects when assigning values to them returned from method calls or expressions. This support is provided through the usage of the dynamic keyword in C# 4.0. You can use the dynamic keyword in C# 4.0 to create objects even when you aren't aware of the type of the object at compile time.