Table of Contents

Class DerivedList<TDerived>

Namespace
Bindables
Assembly
Bindables.dll

A derived list that automatically updates when its source bindable(s) change.

public class DerivedList<TDerived> : IBindableList<TDerived>, IBindable<List<TDerived>>, IBindable, IReadOnlyList<TDerived>, IReadOnlyCollection<TDerived>, IEnumerable<TDerived>, IEnumerable

Type Parameters

TDerived

The type of elements in the list.

Inheritance
DerivedList<TDerived>
Implements
IBindableList<TDerived>
IBindable<List<TDerived>>
IReadOnlyList<TDerived>
IEnumerable<TDerived>
Inherited Members
Extension Methods

Remarks

This class creates a reactive list derived from one or more bindable sources. The list is lazy-evaluated and only subscribes to source changes when it has active listeners.

Properties

Count

public int Count { get; }

Property Value

int

this[int]

public TDerived this[int index] { get; }

Parameters

index int

Property Value

TDerived

Value

Gets the current value of the bindable.

public List<TDerived> Value { get; }

Property Value

List<TDerived>

Methods

From<TSource>(IBindable<TSource>, Func<TSource, IBindableList<TDerived>>)

Creates a derived list from a single bindable source.

public static DerivedList<TDerived> From<TSource>(IBindable<TSource> bindable, Func<TSource, IBindableList<TDerived>> func)

Parameters

bindable IBindable<TSource>

The source bindable to derive from.

func Func<TSource, IBindableList<TDerived>>

The function that transforms the source value into a bindable list.

Returns

DerivedList<TDerived>

A new derived list that updates 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, IBindableList<TDerived>>)

Creates a derived list from two bindable sources.

public static DerivedList<TDerived> From<TSource1, TSource2>(IBindable<TSource1> bindable1, IBindable<TSource2> bindable2, Func<TSource1, TSource2, IBindableList<TDerived>> func)

Parameters

bindable1 IBindable<TSource1>

The first source bindable to derive from.

bindable2 IBindable<TSource2>

The second source bindable to derive from.

func Func<TSource1, TSource2, IBindableList<TDerived>>

The function that transforms the source values into a bindable list.

Returns

DerivedList<TDerived>

A new derived list that updates when any source bindable changes.

Type Parameters

TSource1

The type of the first source bindable value.

TSource2

The type of the second source bindable value.

From<TSource1, TSource2, TSource3>(IBindable<TSource1>, IBindable<TSource2>, IBindable<TSource3>, Func<TSource1, TSource2, TSource3, IBindableList<TDerived>>)

Creates a derived list from three bindable sources.

public static DerivedList<TDerived> From<TSource1, TSource2, TSource3>(IBindable<TSource1> bindable1, IBindable<TSource2> bindable2, IBindable<TSource3> bindable3, Func<TSource1, TSource2, TSource3, IBindableList<TDerived>> func)

Parameters

bindable1 IBindable<TSource1>

The first source bindable to derive from.

bindable2 IBindable<TSource2>

The second source bindable to derive from.

bindable3 IBindable<TSource3>

The third source bindable to derive from.

func Func<TSource1, TSource2, TSource3, IBindableList<TDerived>>

The function that transforms the source values into a bindable list.

Returns

DerivedList<TDerived>

A new derived list that updates when any source bindable changes.

Type Parameters

TSource1

The type of the first source bindable value.

TSource2

The type of the second source bindable value.

TSource3

The type of the third source bindable value.

From<TSource1, TSource2, TSource3, TSource4>(IBindable<TSource1>, IBindable<TSource2>, IBindable<TSource3>, IBindable<TSource4>, Func<TSource1, TSource2, TSource3, TSource4, IBindableList<TDerived>>)

Creates a derived list from four bindable sources.

public static DerivedList<TDerived> From<TSource1, TSource2, TSource3, TSource4>(IBindable<TSource1> bindable1, IBindable<TSource2> bindable2, IBindable<TSource3> bindable3, IBindable<TSource4> bindable4, Func<TSource1, TSource2, TSource3, TSource4, IBindableList<TDerived>> func)

Parameters

bindable1 IBindable<TSource1>

The first source bindable to derive from.

bindable2 IBindable<TSource2>

The second source bindable to derive from.

bindable3 IBindable<TSource3>

The third source bindable to derive from.

bindable4 IBindable<TSource4>

The fourth source bindable to derive from.

func Func<TSource1, TSource2, TSource3, TSource4, IBindableList<TDerived>>

The function that transforms the source values into a bindable list.

Returns

DerivedList<TDerived>

A new derived list that updates when any source bindable changes.

Type Parameters

TSource1

The type of the first source bindable value.

TSource2

The type of the second source bindable value.

TSource3

The type of the third source bindable value.

TSource4

The type of the fourth source bindable value.

GetEnumerator()

public IEnumerator<TDerived> GetEnumerator()

Returns

IEnumerator<TDerived>

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<List<TDerived>> OnChangeWithValue

Event Type

Action<List<TDerived>>

OnElementAdd

Occurs when an element is added to the list.

public event Action<int, TDerived> OnElementAdd

Event Type

Action<int, TDerived>

OnElementChange

Occurs when an element's value is changed in the list.

public event Action<int, TDerived, TDerived> OnElementChange

Event Type

Action<int, TDerived, TDerived>

OnElementMove

Occurs when an element is moved within the list.

public event Action<int, int> OnElementMove

Event Type

Action<int, int>

OnElementRemove

Occurs when an element is removed from the list.

public event Action<int, TDerived> OnElementRemove

Event Type

Action<int, TDerived>

OnElementSwap

Occurs when two elements are swapped in the list.

public event Action<int, int> OnElementSwap

Event Type

Action<int, int>