DynamicObject Constructor

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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

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

Syntax

'Declaration
Protected Sub New
protected DynamicObject()

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.

In Visual Basic, dynamic operations are supported by late binding.

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

Version Information

Silverlight

Supported in: 5, 4

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.