Class ReadOnlyObservableList<T>
- Namespace
- CarinaStudio.Collections
- Assembly
- CarinaStudio.AppBase.Core.dll
Read-only IList<T> which implements INotifyCollectionChanged and INotifyPropertyChanged then wraps another IList<T> which also implements INotifyCollectionChanged.
public class ReadOnlyObservableList<T> : IList, ICollection, IList<T>, ICollection<T>, INotifyCollectionChanged, INotifyPropertyChanged, IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable
Type Parameters
T
Type of elements.
- Inheritance
-
ReadOnlyObservableList<T>
- Implements
-
IList<T>ICollection<T>IEnumerable<T>
- Inherited Members
- Extension Methods
Constructors
ReadOnlyObservableList(IList<T>)
Initialize new ReadOnlyObservableList<T> instance.
public ReadOnlyObservableList(IList<T> source)
Parameters
source
IList<T>
Properties
Count
Get number of elements.
public int Count { get; }
Property Value
this[int]
Get element.
public T this[int index] { get; }
Parameters
index
intIndex of element.
Property Value
- T
Element.
Methods
Contains(T)
Check whether given element is contained in list or not.
public bool Contains(T element)
Parameters
element
TElement.
Returns
- bool
True if element is contained in list.
CopyTo(T[], int)
Copy elements to array.
public void CopyTo(T[] array, int arrayIndex)
Parameters
array
T[]Array to place copied elements.
arrayIndex
intIndex of first position in
array
to place copied elements.
GetEnumerator()
Get IEnumerator<T> to enumerate elements.
public IEnumerator<T> GetEnumerator()
Returns
IndexOf(T)
Get index of given element in list.
public int IndexOf(T element)
Parameters
element
TElement.
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.
Events
CollectionChanged
Raised when list changed.
public event NotifyCollectionChangedEventHandler? CollectionChanged
Event Type
PropertyChanged
Raised when property changed.
public event PropertyChangedEventHandler? PropertyChanged