Class Derived<TDerived>
- Namespace
- Bindables
- Assembly
- Bindables.dll
A derived bindable that automatically updates its value based on one or more source bindables. The derived bindable only subscribes to source changes when it has active listeners, making it efficient for memory usage.
public class Derived<TDerived> : IBindable<TDerived>, IBindable
Type Parameters
TDerivedThe type of the derived value.
- Inheritance
-
Derived<TDerived>
- Implements
-
IBindable<TDerived>
- Inherited Members
- Extension Methods
Properties
Value
Gets the current value of the bindable.
public TDerived Value { get; }
Property Value
- TDerived
Methods
From(Action<Action>, Action<Action>, Func<IBindable<TDerived>>)
public static Derived<TDerived> From(Action<Action> subscribe, Action<Action> unsubscribe, Func<IBindable<TDerived>> getBindable)
Parameters
Returns
- Derived<TDerived>
From<TSource>(IBindable<TSource>, Func<TSource, IBindable<TDerived>>)
Creates a derived bindable that extracts a bindable property from another bindable. Useful for scenarios like extracting Player.Name from a Bindable<Player>.
public static Derived<TDerived> From<TSource>(IBindable<TSource> bindable, Func<TSource, IBindable<TDerived>> func)
Parameters
bindableIBindable<TSource>The source bindable.
funcFunc<TSource, IBindable<TDerived>>Function that extracts the target bindable from the source value.
Returns
- Derived<TDerived>
A derived bindable that updates when either the source or extracted bindable changes.
Type Parameters
TSourceThe type of the source bindable value.
From<TSource>(IBindable<TSource>, Func<TSource, TDerived>)
Transforms one or more bindables into a derived bindable that automatically updates when any source changes.
public static Derived<TDerived> From<TSource>(IBindable<TSource> bindable, Func<TSource, TDerived> func)
Parameters
bindableIBindable<TSource>The source bindable to transform.
funcFunc<TSource, TDerived>The transformation function that converts the source value to the derived value.
Returns
- Derived<TDerived>
A derived bindable that updates automatically when the source bindable changes.
Type Parameters
TSourceThe type of the source bindable value.
From<TSource1, TSource2>(IBindable<TSource1>, IBindable<TSource2>, Func<TSource1, TSource2, IBindable<TDerived>>)
Creates a derived bindable that extracts a bindable property from another bindable. Useful for scenarios like extracting Player.Name from a Bindable<Player>.
public static Derived<TDerived> From<TSource1, TSource2>(IBindable<TSource1> bindable1, IBindable<TSource2> bindable2, Func<TSource1, TSource2, IBindable<TDerived>> func)
Parameters
bindable1IBindable<TSource1>bindable2IBindable<TSource2>funcFunc<TSource1, TSource2, IBindable<TDerived>>Function that extracts the target bindable from the source value.
Returns
- Derived<TDerived>
A derived bindable that updates when either the source or extracted bindable changes.
Type Parameters
TSource1TSource2
From<TSource1, TSource2>(IBindable<TSource1>, IBindable<TSource2>, Func<TSource1, TSource2, TDerived>)
Transforms one or more bindables into a derived bindable that automatically updates when any source changes.
public static Derived<TDerived> From<TSource1, TSource2>(IBindable<TSource1> bindable1, IBindable<TSource2> bindable2, Func<TSource1, TSource2, TDerived> func)
Parameters
bindable1IBindable<TSource1>bindable2IBindable<TSource2>funcFunc<TSource1, TSource2, TDerived>The transformation function that converts the source value to the derived value.
Returns
- Derived<TDerived>
A derived bindable that updates automatically when the source bindable changes.
Type Parameters
TSource1TSource2
From<TSource1, TSource2, TSource3>(IBindable<TSource1>, IBindable<TSource2>, IBindable<TSource3>, Func<TSource1, TSource2, TSource3, IBindable<TDerived>>)
Creates a derived bindable that extracts a bindable property from another bindable. Useful for scenarios like extracting Player.Name from a Bindable<Player>.
public static Derived<TDerived> From<TSource1, TSource2, TSource3>(IBindable<TSource1> bindable1, IBindable<TSource2> bindable2, IBindable<TSource3> bindable3, Func<TSource1, TSource2, TSource3, IBindable<TDerived>> func)
Parameters
bindable1IBindable<TSource1>bindable2IBindable<TSource2>bindable3IBindable<TSource3>funcFunc<TSource1, TSource2, TSource3, IBindable<TDerived>>Function that extracts the target bindable from the source value.
Returns
- Derived<TDerived>
A derived bindable that updates when either the source or extracted bindable changes.
Type Parameters
TSource1TSource2TSource3
From<TSource1, TSource2, TSource3>(IBindable<TSource1>, IBindable<TSource2>, IBindable<TSource3>, Func<TSource1, TSource2, TSource3, TDerived>)
Transforms one or more bindables into a derived bindable that automatically updates when any source changes.
public static Derived<TDerived> From<TSource1, TSource2, TSource3>(IBindable<TSource1> bindable1, IBindable<TSource2> bindable2, IBindable<TSource3> bindable3, Func<TSource1, TSource2, TSource3, TDerived> func)
Parameters
bindable1IBindable<TSource1>bindable2IBindable<TSource2>bindable3IBindable<TSource3>funcFunc<TSource1, TSource2, TSource3, TDerived>The transformation function that converts the source value to the derived value.
Returns
- Derived<TDerived>
A derived bindable that updates automatically when the source bindable changes.
Type Parameters
TSource1TSource2TSource3
From<TSource1, TSource2, TSource3, TSource4>(IBindable<TSource1>, IBindable<TSource2>, IBindable<TSource3>, IBindable<TSource4>, Func<TSource1, TSource2, TSource3, TSource4, IBindable<TDerived>>)
Creates a derived bindable that extracts a bindable property from another bindable. Useful for scenarios like extracting Player.Name from a Bindable<Player>.
public static Derived<TDerived> From<TSource1, TSource2, TSource3, TSource4>(IBindable<TSource1> bindable1, IBindable<TSource2> bindable2, IBindable<TSource3> bindable3, IBindable<TSource4> bindable4, Func<TSource1, TSource2, TSource3, TSource4, IBindable<TDerived>> func)
Parameters
bindable1IBindable<TSource1>bindable2IBindable<TSource2>bindable3IBindable<TSource3>bindable4IBindable<TSource4>funcFunc<TSource1, TSource2, TSource3, TSource4, IBindable<TDerived>>Function that extracts the target bindable from the source value.
Returns
- Derived<TDerived>
A derived bindable that updates when either the source or extracted bindable changes.
Type Parameters
TSource1TSource2TSource3TSource4
From<TSource1, TSource2, TSource3, TSource4>(IBindable<TSource1>, IBindable<TSource2>, IBindable<TSource3>, IBindable<TSource4>, Func<TSource1, TSource2, TSource3, TSource4, TDerived>)
Transforms one or more bindables into a derived bindable that automatically updates when any source changes.
public static Derived<TDerived> From<TSource1, TSource2, TSource3, TSource4>(IBindable<TSource1> bindable1, IBindable<TSource2> bindable2, IBindable<TSource3> bindable3, IBindable<TSource4> bindable4, Func<TSource1, TSource2, TSource3, TSource4, TDerived> func)
Parameters
bindable1IBindable<TSource1>bindable2IBindable<TSource2>bindable3IBindable<TSource3>bindable4IBindable<TSource4>funcFunc<TSource1, TSource2, TSource3, TSource4, TDerived>The transformation function that converts the source value to the derived value.
Returns
- Derived<TDerived>
A derived bindable that updates automatically when the source bindable changes.
Type Parameters
TSource1TSource2TSource3TSource4
ToString()
public override string ToString()
Returns
Events
OnChange
Event triggered when the bindable value changes.
public event Action OnChange
Event Type
OnChangeWithValue
Event triggered when the bindable value changes, providing the new value.
public event Action<TDerived> OnChangeWithValue
Event Type
- Action<TDerived>
Operators
implicit operator TDerived(Derived<TDerived>)
public static implicit operator TDerived(Derived<TDerived> derived)
Parameters
derivedDerived<TDerived>
Returns
- TDerived