Monday, November 30, 2009

.NET 4.0 FAQ: Part I - The DLR


In this article we will discuss about what new features are provided by .NET framework 4.0. We will then take up the DLR feature and discuss about 'dynamic' and 'expando' objects. We will also create a custom 'expando' class and see what benefits we can get from the same. Many developers mistake 'dynamic' objects where made to replace 'reflection' and 'object' type, we will try to remove this misconception also.

Sorry for the repost. I have deleted the old article due to image upload issues and uploaded again.

Please feel free to download my free 500 question and answer eBook which covers .NET 4.0 , ASP.NET , design patterns, silver light, LINQ, SQL Server , WCF , WPF, WWF@ 

Where do I get .Net 4.0 from?

What are the important new features in .NET 4.0?

Rather than walking through the 100 new features list, let's concentrate on the top 3 features which we think are important. If you are interested to see the detail list of new features click here.
  • Windows work flow and WCF 4.0:- This is a major change in 4.0. In WCF they have introduced simplified configuration, discovery, routing service, REST improvements and workflow services. In WWF they have made changes to the core programming model of workflow. Programming model has been made more simple and robust. The biggest thing is the integration between WCF and WWF.
  • Dynamic Language runtime: - DLR adds dynamic programming capability to .NET 4.0 CLR. We will talk more about it as this FAQ moves ahead.
  • Parallel extensions: - This will help to support parallel computing for multi-core systems. .NET 4.0 has PLINQ in the LINQ engine to support parallel execution. TPL (Task parallel library) is introduced which exposes parallel constructs like parallel 'For' and 'ForEach' loops, using regular method calls and delegates.
We will be talking in more details of the above features in the coming sections. 

What's the most important new feature of .NET 4.0?

WCF and WWF new features are one of the most interesting features of all. Especially the new programming model of WWF and its integration with WCF will be an interesting thing to watch.

DLR, parallel programming and other new features somehow just seem to be brownie points rather than compelling features. Kathleen Dollard's talks about it in more details

We will be seeing more of these features as we continue with the FAQ. 

What is DLR in .NET 4.0 framework?

DLR (Dynamic language runtime) is set of services which add dynamic programming capability to CLR. DLR makes dynamic languages like LISP, Javascript, PHP,Ruby to run on .NET framework.

There are two types of languages statically typed languages and dynamically typed languages. In statically typed languages you need to specify the object during design time / compile time. Dynamically typed languages can identify the object during runtime. .NET . DLR helps you to host code written in dynamic languages on top of your CLR.


Due to DLR runtime, dynamic languages like ruby, python, JavaScript etc can integrate and run seamlessly with CLR. DLR thus helps to build the best experience for your favorite dynamic language. Your code becomes much cleaner and seamless while integrating with the dynamic languages.


Integration with DLR is not limited to dynamic languages. You can also call MS office components in a much cleaner way by using COM interop binder.

One of the important advantages of DLR is that it provides one central and unified subsystem for dynamic language integration.  

Can you give more details about DLR subsystem?

See full details:

No comments: