Tuesday, July 15, 2014

C# Interview Questions

What is dynamic ? 

  1. The dynamic type enables the operations in which it occurs to bypass compile-time type checking. Instead, these operations are resolved at run time. Thedynamic type simplifies access to COM APIs such as the Office Automation APIs, and also to dynamic APIs such as IronPython libraries, and to the HTML Document Object Model (DOM).
  2. The type is a static type, but an object of type dynamic bypasses static type checking. 
E.g.

/ Before the introduction of dynamic.
((Excel.Range)excelApp.Cells[1, 1]).Value2 = "Name";
// After the introduction of dynamic, the access to the Value property and 
// the conversion to Excel.Range are handled by the run-time COM binder.
excelApp.Cells[1, 1].Value = "Name";

No comments:

Post a Comment