DynamicObject Constructor
Collapse the table of content
Expand the table of content

DynamicObject Constructor

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

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

Namespace:  System.Dynamic
Assembly:  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 [3828989d-c967-4a51-b948-857ebc8fdf26].

In Visual Basic, dynamic operations are supported by late binding. For more information, see [d6ff7f1e-b94f-4205-ab8d-5cfa91758724].

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()

Windows Phone OS

Supported in: 8.1, 8.0

Show:
© 2017 Microsoft