Table of Contents

Class TypeConvertedObservableList<TSrc, TDest>

Namespace
CarinaStudio.Collections
Assembly
CarinaStudio.AppBase.Core.dll

IList<T> which wraps another IList<T> and convert elements to another type. Elements will be updated automatically if source IList<T> implements INotifyCollectionChanged interface.

public abstract class TypeConvertedObservableList<TSrc, TDest> : BaseDisposable, IDisposable, IList, ICollection, IList<TDest>, ICollection<TDest>, INotifyCollectionChanged, INotifyPropertyChanged, IReadOnlyList<TDest>, IReadOnlyCollection<TDest>, IEnumerable<TDest>, IEnumerable

Type Parameters

TSrc

Type of element of source list.

TDest

Type of converted elements.

Inheritance
TypeConvertedObservableList<TSrc, TDest>
Implements
IList<TDest>
Inherited Members
Extension Methods

Constructors

TypeConvertedObservableList(IList<TSrc>)

protected TypeConvertedObservableList(IList<TSrc> source)

Parameters

source IList<TSrc>

Source list.

Properties

Count

Get number of elements.

public int Count { get; }

Property Value

int

this[int]

Get element.

public TDest this[int index] { get; }

Parameters

index int

Index of element.

Property Value

TDest

Element.

Methods

Contains(TDest)

Check whether given element is contained in list or not.

public bool Contains(TDest element)

Parameters

element TDest

Element.

Returns

bool

True if element is contained in list.

ConvertElement(TSrc)

Convert source element to element in this list.

protected abstract TDest ConvertElement(TSrc srcElement)

Parameters

srcElement TSrc

Element in source list.

Returns

TDest

Converted element.

CopyTo(TDest[], int)

Copy elements to array.

public void CopyTo(TDest[] array, int arrayIndex)

Parameters

array TDest[]

Array to place copied elements.

arrayIndex int

Index of first position in array to place copied elements.

Dispose(bool)

Dispose the list.

protected override void Dispose(bool disposing)

Parameters

disposing bool

True to release managed resources.

GetEnumerator()

Get IEnumerator<T> to enumerate elements.

public IEnumerator<TDest> GetEnumerator()

Returns

IEnumerator<TDest>

IEnumerator<T>.

IndexOf(TDest)

Get index of given element in list.

public int IndexOf(TDest element)

Parameters

element TDest

Element.

Returns

int

Index of element in list, or -1 if element is not contained in list.

IsEmpty()

Check whether the list is empty or not.

public bool IsEmpty()

Returns

bool

True if the list is empty.

IsNotEmpty()

Check whether the list is not empty or not.

public bool IsNotEmpty()

Returns

bool

True if the list is not empty.

ReleaseElement(TDest)

Release converted element.

protected virtual void ReleaseElement(TDest element)

Parameters

element TDest

Converted element.

TrimExcess()

Set the capacity to the actual number of elements in list.

public void TrimExcess()

Events

CollectionChanged

Raised when list changed.

public event NotifyCollectionChangedEventHandler? CollectionChanged

Event Type

NotifyCollectionChangedEventHandler

PropertyChanged

Raised when property changed.

public event PropertyChangedEventHandler? PropertyChanged

Event Type

PropertyChangedEventHandler