Class ObservableObject
Base or inner class for observable objects.
Inheritance
Namespace: Cortex.Net.Types
Assembly: Cortex.Net.dll
Syntax
public sealed class ObservableObject : object, IReactiveObject, IAtomProvider
Constructors
| Improve this Doc View SourceObservableObject(String, IEnhancer, ISharedState, IDictionary<String, IValue>)
Initializes a new instance of the ObservableObject class.
Declaration
public ObservableObject(string name, IEnhancer defaultEnhancer, ISharedState sharedState, IDictionary<string, IValue> values = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the objservable ovject. |
IEnhancer | defaultEnhancer | The default enhancer to use for newly created values. |
ISharedState | sharedState | The shared state for this ObservableObject. |
IDictionary<System.String, IValue> | values | A dictionary with values. |
Properties
| Improve this Doc View SourceName
Gets the name of this ObservableObject.
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
System.String |
SharedState
Gets the Shared State on this object.
Declaration
public ISharedState SharedState { get; }
Property Value
Type | Description |
---|---|
ISharedState |
Methods
| Improve this Doc View SourceAddComputedMember<T>(String, ComputedValueOptions<T>)
Adds a Computed Value.
Declaration
public void AddComputedMember<T>(string key, ComputedValueOptions<T> computedValueOptions)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key of the member. |
ComputedValueOptions<T> | computedValueOptions | The computed value options. |
Type Parameters
Name | Description |
---|---|
T | The return type of the member. |
AddObservableProperty<T>(String, T, IEnhancer)
Adds an Observable property to this ObservableObject instnace.
Declaration
public void AddObservableProperty<T>(string propertyName, T initialValue = null, IEnhancer enhancer = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName | The name of the property. |
T | initialValue | The initial value. |
IEnhancer | enhancer | The enhancer to use. |
Type Parameters
Name | Description |
---|---|
T | The type of the property. |
Has(String)
Returns whether this ObservableObject instance has a property of method with the name key
.
Declaration
public bool Has(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key to check. |
Returns
Type | Description |
---|---|
System.Boolean | True when this object contains the key, false otherwise. |
Read<T>(String)
Gets the value for property or method with specified key.
Declaration
public T Read<T>(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key. |
Returns
Type | Description |
---|---|
T | The value. |
Type Parameters
Name | Description |
---|---|
T | The type of the value. |
Remove(String)
Removes a property or computed value.
Declaration
public void Remove(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key to remove. |
Write<T>(String, T)
Sets the value for property or method with the specified value.
Declaration
public void Write<T>(string key, T value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key. |
T | value | The value. |
Type Parameters
Name | Description |
---|---|
T | The type of the value. |
Events
| Improve this Doc View SourceChange
Event that fires before a value on the object will change.
Declaration
public event EventHandler<ObjectCancellableEventArgs> Change
Event Type
Type | Description |
---|---|
EventHandler<ObjectCancellableEventArgs> |
Changed
Event that fires after a value on the object has changed.
Declaration
public event EventHandler<ObjectEventArgs> Changed
Event Type
Type | Description |
---|---|
EventHandler<ObjectEventArgs> |
Explicit Interface Implementations
| Improve this Doc View SourceIAtomProvider.Atom
Gets the atom.
Declaration
IAtom IAtomProvider.Atom { get; }
Returns
Type | Description |
---|---|
IAtom |