Dynamic binding is a process to bind elements at runtime. It is also known as association of method at runtime not compile time. Dynamic binding in c# defers binding i.e. the process of resolving types, operators and members from compile time to runtime. We can use dynamic binding when we know that certain function, member or operation exists at compile time but the compiler does not know about its existence until that member is called at runtime. This process normally occurs when interrupting with dynamic languages or com or when we use concept of reflection in our program.   

A dynamic type is declared by using keyword dynamic:

dynamic obj = CallSomeMethod();

A dynamic type informs the compiler to expects the runtime type of obj to disp() method.

  Modified On Sep-18-2014 01:23:55 PM

Leave Comment