Table of Contents

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

TDerived

The 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

subscribe Action<Action>
unsubscribe Action<Action>
getBindable Func<IBindable<TDerived>>

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

bindable IBindable<TSource>

The source bindable.

func Func<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

TSource

The 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

bindable IBindable<TSource>

The source bindable to transform.

func Func<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

TSource

The 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

bindable1 IBindable<TSource1>
bindable2 IBindable<TSource2>
func Func<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

TSource1
TSource2

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

bindable1 IBindable<TSource1>
bindable2 IBindable<TSource2>
func Func<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

TSource1
TSource2

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

bindable1 IBindable<TSource1>
bindable2 IBindable<TSource2>
bindable3 IBindable<TSource3>
func Func<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

TSource1
TSource2
TSource3

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

bindable1 IBindable<TSource1>
bindable2 IBindable<TSource2>
bindable3 IBindable<TSource3>
func Func<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

TSource1
TSource2
TSource3

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

bindable1 IBindable<TSource1>
bindable2 IBindable<TSource2>
bindable3 IBindable<TSource3>
bindable4 IBindable<TSource4>
func Func<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

TSource1
TSource2
TSource3
TSource4

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

bindable1 IBindable<TSource1>
bindable2 IBindable<TSource2>
bindable3 IBindable<TSource3>
bindable4 IBindable<TSource4>
func Func<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

TSource1
TSource2
TSource3
TSource4

ToString()

public override string ToString()

Returns

string

Events

OnChange

Event triggered when the bindable value changes.

public event Action OnChange

Event Type

Action

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

derived Derived<TDerived>

Returns

TDerived