Class ReactivePort<T>
A reactive port that stores a value and notifies when it changes. Thread-safe for UI binding scenarios.
public sealed class ReactivePort<T> : IPortValue<T>, IPortValue, INotifyPropertyChanged
Type Parameters
TThe type of value this port holds.
- Inheritance
-
ReactivePort<T>
- Implements
-
IPortValue<T>
- Inherited Members
Constructors
ReactivePort(string, T?)
Creates a new reactive port.
public ReactivePort(string portId, T? initialValue = default)
Parameters
portIdstringThe port identifier.
initialValueTThe initial value.
Properties
PortId
Gets the port ID this value belongs to.
public string PortId { get; }
Property Value
TypedValue
Gets or sets the typed value.
public T? TypedValue { get; set; }
Property Value
- T
ValueType
Gets the CLR type of the value.
public Type ValueType { get; }
Property Value
Methods
SetValue(object?)
Sets the value from an untyped object.
public void SetValue(object? value)
Parameters
valueobjectThe value to set. Must be compatible with ValueType.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
Events
PropertyChanged
Occurs when a property value changes.
public event PropertyChangedEventHandler? PropertyChanged
Event Type
TypedValueChanged
Event raised when the value changes with typed arguments.
public event EventHandler<PortValueChangedEventArgs<T>>? TypedValueChanged
Event Type
ValueChanged
Event raised when the value changes (non-generic).
public event EventHandler<PortValueChangedEventArgs>? ValueChanged
Event Type
Operators
implicit operator T?(ReactivePort<T>)
Implicitly converts a ReactivePort to its value.
public static implicit operator T?(ReactivePort<T> port)
Parameters
portReactivePort<T>
Returns
- T