Table of Contents

Class DynamicClass

Namespace
Tripous
Assembly
Tripous.dll

Represents a dynamic object whose properties are stored in a dictionary.

Supports dynamic member access, property change notifications, custom type descriptors and JSON serialization.

public class DynamicClass : DynamicObject, IDynamicMetaObjectProvider, INotifyPropertyChanged, ICustomTypeDescriptor
Inheritance
DynamicClass
Implements
Inherited Members
Extension Methods

Constructors

DynamicClass()

Constructor.

public DynamicClass()

DynamicClass(string)

Constructs an instance from a JSON string.

public DynamicClass(string JsonText)

Parameters

JsonText string

Properties

this[string]

Gets or sets a dynamic property value by property name.

[JsonIgnore]
public object this[string PropName] { get; set; }

Parameters

PropName string

Property Value

object

Properties

Gets or sets the dictionary that stores dynamic properties.

public Dictionary<string, object> Properties { get; set; }

Property Value

Dictionary<string, object>

PropertyCount

Gets the number of dynamic properties.

[JsonIgnore]
public int PropertyCount { get; }

Property Value

int

Methods

FromJson(string)

Loads this instance from a JSON string.

public void FromJson(string JsonText)

Parameters

JsonText string

GetAttributes()

Returns the attributes of this instance.

public AttributeCollection GetAttributes()

Returns

AttributeCollection

GetClassName()

Returns the class name.

public string GetClassName()

Returns

string

GetComponentName()

Returns the component name.

public string GetComponentName()

Returns

string

GetConverter()

Returns the type converter.

public TypeConverter GetConverter()

Returns

TypeConverter

GetDefaultEvent()

Returns the default event.

public EventDescriptor GetDefaultEvent()

Returns

EventDescriptor

GetDefaultProperty()

Returns the default property.

public PropertyDescriptor GetDefaultProperty()

Returns

PropertyDescriptor

GetEditor(Type)

Returns an editor of the specified base type.

public object GetEditor(Type EditorBaseType)

Parameters

EditorBaseType Type

Returns

object

GetEvents()

Returns the events of this instance.

public EventDescriptorCollection GetEvents()

Returns

EventDescriptorCollection

GetEvents(Attribute[])

Returns the events of this instance matching the specified attributes.

public EventDescriptorCollection GetEvents(Attribute[] Attributes)

Parameters

Attributes Attribute[]

Returns

EventDescriptorCollection

GetProperties()

Returns the dynamic properties of this instance.

public PropertyDescriptorCollection GetProperties()

Returns

PropertyDescriptorCollection

GetProperties(Attribute[])

Returns the dynamic properties of this instance matching the specified attributes.

public PropertyDescriptorCollection GetProperties(Attribute[] Attributes)

Parameters

Attributes Attribute[]

Returns

PropertyDescriptorCollection

GetPropertyOwner(PropertyDescriptor)

Returns the owner of the specified property descriptor.

public object GetPropertyOwner(PropertyDescriptor Pd)

Parameters

Pd PropertyDescriptor

Returns

object

RemoveAllProperties()

Removes all dynamic properties.

public void RemoveAllProperties()

ToJson()

Serializes this instance to JSON.

public string ToJson()

Returns

string

TryGetMember(GetMemberBinder, out object)

Gets a dynamic member value.

public override bool TryGetMember(GetMemberBinder Binder, out object Result)

Parameters

Binder GetMemberBinder
Result object

Returns

bool

TrySetMember(SetMemberBinder, object)

Sets a dynamic member value.

public override bool TrySetMember(SetMemberBinder Binder, object Value)

Parameters

Binder SetMemberBinder
Value object

Returns

bool

Events

PropertyChanged

Occurs when a dynamic property value changes.

public event PropertyChangedEventHandler PropertyChanged

Event Type

PropertyChangedEventHandler