Home > Articles > Programming > C#

  • Print
  • + Share This
This chapter is from the book

4.7 The dynamic Type

The type dynamic has special meaning in C#. Its purpose is to allow dynamic binding, which is described in detail in §7.2.2.

The dynamic type is considered identical to the object type except in the following respects:

  • Operations on expressions of type dynamic can be dynamically bound (§7.2.2).
  • Type inference (§7.5.2) will prefer dynamic over object if both are candidates.

Because of this equivalence, the following statements hold:

  • There is an implicit identity conversion between object and dynamic, and between constructed types that are the same when replacing dynamic with object.
  • Implicit and explicit conversions to and from object also apply to and from dynamic.
  • Method signatures that are the same when replacing dynamic with object are considered the same signature.

The type dynamic is indistinguishable from object at runtime.

An expression of the type dynamic is referred to as a dynamic expression.

  • + Share This
  • 🔖 Save To Your Account