DynamicObject Constructor
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Enables derived types to initialize a new instance of the DynamicObject type.
protected:
DynamicObject();
protected DynamicObject ();
Protected Sub New ()
Examples
The following code example demonstrates how to create an instance of classes that are derived from the DynamicObject class.
public class SampleDynamicObject : DynamicObject {}
//...
dynamic sampleObject = new SampleDynamicObject ();
Public Class SampleDynamicObject
Inherits DynamicObject
'...
Dim sampleObject As Object = New SampleDynamicObject()
Remarks
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.
In Visual Basic, dynamic operations are supported by late binding. For more information, see Early and Late Binding (Visual Basic).