This documentation is archived and is not being maintained.

DynamicObject Constructor

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

Namespace:  System.Dynamic
Assembly:  System.Core (in System.Core.dll)

protected DynamicObject()

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 : DynamicObject {}
dynamic sampleObject = new SampleDynamicObject ();

.NET Framework

Supported in: 4

.NET Framework Client Profile

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.