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)

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.6, 4.5, 4

.NET Framework Client Profile

Supported in: 4

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone Silverlight 8.1, Windows Phone Silverlight 8

Portable Class Library

Supported in: Portable Class Library
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft