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
JsonTextstring
Properties
this[string]
Gets or sets a dynamic property value by property name.
[JsonIgnore]
public object this[string PropName] { get; set; }
Parameters
PropNamestring
Property Value
Properties
Gets or sets the dictionary that stores dynamic properties.
public Dictionary<string, object> Properties { get; set; }
Property Value
PropertyCount
Gets the number of dynamic properties.
[JsonIgnore]
public int PropertyCount { get; }
Property Value
Methods
FromJson(string)
Loads this instance from a JSON string.
public void FromJson(string JsonText)
Parameters
JsonTextstring
GetAttributes()
Returns the attributes of this instance.
public AttributeCollection GetAttributes()
Returns
GetClassName()
Returns the class name.
public string GetClassName()
Returns
GetComponentName()
Returns the component name.
public string GetComponentName()
Returns
GetConverter()
Returns the type converter.
public TypeConverter GetConverter()
Returns
GetDefaultEvent()
Returns the default event.
public EventDescriptor GetDefaultEvent()
Returns
GetDefaultProperty()
Returns the default property.
public PropertyDescriptor GetDefaultProperty()
Returns
GetEditor(Type)
Returns an editor of the specified base type.
public object GetEditor(Type EditorBaseType)
Parameters
EditorBaseTypeType
Returns
GetEvents()
Returns the events of this instance.
public EventDescriptorCollection GetEvents()
Returns
GetEvents(Attribute[])
Returns the events of this instance matching the specified attributes.
public EventDescriptorCollection GetEvents(Attribute[] Attributes)
Parameters
AttributesAttribute[]
Returns
GetProperties()
Returns the dynamic properties of this instance.
public PropertyDescriptorCollection GetProperties()
Returns
GetProperties(Attribute[])
Returns the dynamic properties of this instance matching the specified attributes.
public PropertyDescriptorCollection GetProperties(Attribute[] Attributes)
Parameters
AttributesAttribute[]
Returns
GetPropertyOwner(PropertyDescriptor)
Returns the owner of the specified property descriptor.
public object GetPropertyOwner(PropertyDescriptor Pd)
Parameters
Returns
RemoveAllProperties()
Removes all dynamic properties.
public void RemoveAllProperties()
ToJson()
Serializes this instance to JSON.
public string ToJson()
Returns
TryGetMember(GetMemberBinder, out object)
Gets a dynamic member value.
public override bool TryGetMember(GetMemberBinder Binder, out object Result)
Parameters
BinderGetMemberBinderResultobject
Returns
TrySetMember(SetMemberBinder, object)
Sets a dynamic member value.
public override bool TrySetMember(SetMemberBinder Binder, object Value)
Parameters
BinderSetMemberBinderValueobject
Returns
Events
PropertyChanged
Occurs when a dynamic property value changes.
public event PropertyChangedEventHandler PropertyChanged