Export (0) Print
Expand All

DynamicObject Constructor

Enables derived types to initialize a new instance of the DynamicObject type.

Namespace:  System.Dynamic
Assemblies:   System.Dynamic.Runtime (in System.Dynamic.Runtime.dll)
  System.Core (in System.Core.dll)

'Declaration
Protected Sub New

You cannot directly create an instance of the DynamicObject class. To implement dynamic behavior, you have to inherit from the DynamicObject class and override necessary methods.

In C#, to enable dynamic behavior for instances of the classes derived from the DynamicObject class, you must use the dynamic keyword. For more information, see Using Type dynamic (C# Programming Guide).

In Visual Basic, dynamic operations are supported by late binding. For more information, see Early and Late Binding (Visual Basic).

The following code example demonstrates how to create an instance of classes that are derived from the DynamicObject class.

Public Class SampleDynamicObject 
    Inherits DynamicObject
'...
Dim sampleObject As Object = New SampleDynamicObject()

.NET Framework

Supported in: 4.6, 4.5, 4

.NET Framework Client Profile

Supported in: 4

Portable Class Library

Supported in: Portable Class Library

Supported in: Windows Phone 8.1

Supported in: Windows Phone Silverlight 8.1

Supported in: Windows Phone Silverlight 8
Show:
© 2015 Microsoft