find and solve ||
Please wait.....

Welcome back.

Before Read Terms of use

What is Dynamic Language Runtime (DLR) in c#

DLR is a runtime environment that integrates dynamic languages with the CLR by adding a set of service to the CLR.It helps you to run dynamic languages on the .NET Framework.DLR enables the identification of data types of an object at runtime and allows the statically-typed languages,such as c#   and visual basic,to interoperate with the dynamic languages.Apart from these features,DLR also creates a number of libraries that help you to write less and simple code while operating with objects and accessing data members.

DLR is introduced as a part of the .NET Framework similar to the CLR.It can be implemented in an application by including the System.Dynamic and System.RUntime.Compilerservices namespaces in the application.

DLR provides various advantages,which are as follows:

⦁Allows you to easily implement the dynamic languages in the .NET Framwework.Some examples of dynamic languages are LISP,JavaScript,RUby,HYpertext Preprocessor[PHP],Python,ColdFusion,and Cobra.

⦁Provides dynamic features to statically-typed language.The statically-typed .NET Framework languages,such as CSharp and visual basic,can create dynamic objects and use them together with statically-typed objects.

⦁Supports sharing of libraries and objects,which means that the objects and libraries implemented in one language can be used by other languages using DLR. The DLR also enables interoperation between statically-typed and dynamic language.For example,you can use a dynamic object created in a dynamic language in a statically-typed language,such as c#

⦁Enables false execution of dynamic operations by supporting advance caching.

IN .NET Framework 4.0,DLR allows the dynamic languages to run on .NET Framework.DLR provides some services to the CLR,such as expression trees,call site caching ,and dynamic object interchangeability,to support language interoperation. These services are described as follows:

⦁Expresion Trees: Refers to the representation of code in a data strucutre similar to a tree.However,expression trees in DLR are the advanced version of the expression trees that were introduced with Language Integrated  Query(LINQ) in .NET. Therefore,DLR includes the functionalities of LINQ expression trees,such as control flow,assignment,and other language-modeling nodes.These expression trees define the semantics of a language in form of an abastract syntax tree(AST).The AST enables the DLR to dynamically generate code (expression trees) in place of Intermediate Language(IL),which the CLR executes at rentime.

⦁Call Site Caching: Enables DLR to store all the information of the variables,such as their data types,as well as of the operations performed on these variables.The call site caching also enables the DLR to check whether such operations have been preformed previously and if so,the DLR retrives all the information about the variables and then reuses that information whenever required .The place where DLR stores these values is called call site.

⦁Dynamic OBject Interoperability: Enables the DLR to provide a set classes and interfaces that represent dynamic objects and operation.The authors of dynamic libraries use these classes and interfaces to create dynamic libraries,which can be used with the static and dynamic type languages.

Sundar  Neupane

Sundar Neupane

I like working on projects with a team that cares about creating beautiful and usable interfaces.


Report Response