What is the difference between CLR and DLR in C#?

masoud ramezani picture masoud ramezani · Nov 15, 2010 · Viewed 18.8k times · Source

What is the difference between CLR and DLR in C#? are these two concept comparable?

Answer

Joey picture Joey · Nov 15, 2010

The Common Language Runtime (CLR) is the core set of services offered by .NET – a type system, JIT, a garbage collector, &c. Those are available to all .NET languages, hence the "Common" part.

The Dynamic Language Runtime (DLR) builds atop of this and offers services for dynamic languages: dynamic types, dynamic method dispatch, code generation, &c. The idea is to make those things uniform and share them among dynamic languages so that they work predictably and similar, just like things on the CLR are across all languages too.

In a way those are comparable, a "normal" language on .NET uses the CLR, a dynamic language should use the DLR, but will use the CLR as well. They are basic sets of functionality that the designers considered to be good when they are common across languages. IronPython and IronRuby were implemented on top of the DLR, as is C# 4's dynamic feature.