User Tools

Site Tools


notes:csharp:dynamic

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
notes:csharp:dynamic [2015/12/04]
admin
notes:csharp:dynamic [2016/10/26] (current)
admin
Line 2: Line 2:
  
   * Using dynamic types does not generate any compile-time errors, although it may generate runtime errors.   * Using dynamic types does not generate any compile-time errors, although it may generate runtime errors.
-  * At compile time, an element that is typed as //dynamic// is assumed to support any operation.+  * At compile-time, an element that is typed as //dynamic// is assumed to support any operation.
   * Overload resolution occurs at run-time rather than at compile-time.   * Overload resolution occurs at run-time rather than at compile-time.
   * In order to use dynamic typing, reference the //​Microsoft.CSharp.dll//​ assembly.   * In order to use dynamic typing, reference the //​Microsoft.CSharp.dll//​ assembly.
Line 11: Line 11:
   * //​ExpandoObject//​ - enables you to add and delete members of a class instances at run-time and also to set and get values of these members   * //​ExpandoObject//​ - enables you to add and delete members of a class instances at run-time and also to set and get values of these members
  
-**Example**: A simple example of dynamic typing:+Example: A simple example of dynamic typing:
 <code csharp> <code csharp>
 dynamic v = "​Testing";​ dynamic v = "​Testing";​
Line 25: Line 25:
 </​code>​ </​code>​
  
-**Example**: Overload ​the MainClass.Test ​method with an argument of type //​dynamic//​. Note that overload resolution occurs at run-time rather than at compile-time:​+Example: Overload ​method with an argument of type //​dynamic//​. Note that overload resolution occurs at run-time rather than at compile-time:​
 <code csharp> <code csharp>
 class Program class Program
notes/csharp/dynamic.txt ยท Last modified: 2016/10/26 by admin