Dynamic Type:
The dynamic type enables
the operations in which it occurs to bypass compile-time type checking.
Instead, these operations are resolved at run time.
Type dynamic behaves like
type object in most circumstances. However, operations that contain expressions
of type dynamic are not resolved or type checked by the compiler. The compiler
packages together information about the operation and that information are
later used to evaluate the operation at run time. As part of the process,
variables of type dynamic are compiled into variables of type object.
Therefore, type dynamic exists only at compile time, not at run time.

A compiler error is reported for the attempted addition of an
integer and an object in expression obj
+ 3. However, no error is reported for dyn
+ 3. The expression that contains dyn
is not checked at compile time because the type of dyn is dynamic.

Comments
Post a Comment