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
TDerivedThe type of elements in the list.
- Inheritance
-
DerivedList<TDerived>
- Implements
-
IBindableList<TDerived>IReadOnlyList<TDerived>IReadOnlyCollection<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
this[int]
public TDerived this[int index] { get; }
Parameters
indexint
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
bindableIBindable<TSource>The source bindable to derive from.
funcFunc<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
TSourceThe 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
bindable1IBindable<TSource1>The first source bindable to derive from.
bindable2IBindable<TSource2>The second source bindable to derive from.
funcFunc<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
TSource1The type of the first source bindable value.
TSource2The 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
bindable1IBindable<TSource1>The first source bindable to derive from.
bindable2IBindable<TSource2>The second source bindable to derive from.
bindable3IBindable<TSource3>The third source bindable to derive from.
funcFunc<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
TSource1The type of the first source bindable value.
TSource2The type of the second source bindable value.
TSource3The 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
bindable1IBindable<TSource1>The first source bindable to derive from.
bindable2IBindable<TSource2>The second source bindable to derive from.
bindable3IBindable<TSource3>The third source bindable to derive from.
bindable4IBindable<TSource4>The fourth source bindable to derive from.
funcFunc<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
TSource1The type of the first source bindable value.
TSource2The type of the second source bindable value.
TSource3The type of the third source bindable value.
TSource4The 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
OnChangeWithValue
Event triggered when the bindable value changes, providing the new value.
public event Action<List<TDerived>> OnChangeWithValue
Event Type
OnElementAdd
Occurs when an element is added to the list.
public event Action<int, TDerived> OnElementAdd
Event Type
OnElementChange
Occurs when an element's value is changed in the list.
public event Action<int, TDerived, TDerived> OnElementChange
Event Type
OnElementMove
Occurs when an element is moved within the list.
public event Action<int, int> OnElementMove
Event Type
OnElementRemove
Occurs when an element is removed from the list.
public event Action<int, TDerived> OnElementRemove
Event Type
OnElementSwap
Occurs when two elements are swapped in the list.
public event Action<int, int> OnElementSwap