Show / Hide Table of Contents

    Class ObservableRangeCollection<T>

    Implementation of a dynamic data collection based on generic Collection<T>, implementing INotifyCollectionChanged to notify listeners when items get added, removed or the whole list is refreshed.

    Inheritance
    System.Object
    System.Collections.ObjectModel.Collection<T>
    System.Collections.ObjectModel.ObservableCollection<T>
    ObservableRangeCollection<T>
    Implements
    System.Collections.Generic.IList<T>
    System.Collections.Generic.ICollection<T>
    System.Collections.Generic.IReadOnlyList<T>
    System.Collections.Generic.IReadOnlyCollection<T>
    System.Collections.Generic.IEnumerable<T>
    System.Collections.IList
    System.Collections.ICollection
    System.Collections.IEnumerable
    System.Collections.Specialized.INotifyCollectionChanged
    System.ComponentModel.INotifyPropertyChanged
    Inherited Members
    System.Collections.ObjectModel.ObservableCollection<T>.BlockReentrancy()
    System.Collections.ObjectModel.ObservableCollection<T>.CheckReentrancy()
    System.Collections.ObjectModel.ObservableCollection<T>.InsertItem(System.Int32, T)
    System.Collections.ObjectModel.ObservableCollection<T>.Move(System.Int32, System.Int32)
    System.Collections.ObjectModel.ObservableCollection<T>.MoveItem(System.Int32, System.Int32)
    System.Collections.ObjectModel.ObservableCollection<T>.OnPropertyChanged(System.ComponentModel.PropertyChangedEventArgs)
    System.Collections.ObjectModel.ObservableCollection<T>.RemoveItem(System.Int32)
    System.Collections.ObjectModel.ObservableCollection<T>.CollectionChanged
    System.Collections.ObjectModel.ObservableCollection<T>.PropertyChanged
    System.Collections.ObjectModel.ObservableCollection<T>.System.ComponentModel.INotifyPropertyChanged.PropertyChanged
    System.Collections.ObjectModel.Collection<T>.System.Collections.IList.get_Item(System.Int32)
    System.Collections.ObjectModel.Collection<T>.System.Collections.IList.set_Item(System.Int32, System.Object)
    System.Collections.ObjectModel.Collection<T>.Add(T)
    System.Collections.ObjectModel.Collection<T>.Clear()
    System.Collections.ObjectModel.Collection<T>.Contains(T)
    System.Collections.ObjectModel.Collection<T>.CopyTo(T[], System.Int32)
    System.Collections.ObjectModel.Collection<T>.GetEnumerator()
    System.Collections.ObjectModel.Collection<T>.IndexOf(T)
    System.Collections.ObjectModel.Collection<T>.Insert(System.Int32, T)
    System.Collections.ObjectModel.Collection<T>.Remove(T)
    System.Collections.ObjectModel.Collection<T>.RemoveAt(System.Int32)
    System.Collections.ObjectModel.Collection<T>.System.Collections.ICollection.CopyTo(System.Array, System.Int32)
    System.Collections.ObjectModel.Collection<T>.System.Collections.IEnumerable.GetEnumerator()
    System.Collections.ObjectModel.Collection<T>.System.Collections.IList.Add(System.Object)
    System.Collections.ObjectModel.Collection<T>.System.Collections.IList.Contains(System.Object)
    System.Collections.ObjectModel.Collection<T>.System.Collections.IList.IndexOf(System.Object)
    System.Collections.ObjectModel.Collection<T>.System.Collections.IList.Insert(System.Int32, System.Object)
    System.Collections.ObjectModel.Collection<T>.System.Collections.IList.Remove(System.Object)
    System.Collections.ObjectModel.Collection<T>.Count
    System.Collections.ObjectModel.Collection<T>.Item[System.Int32]
    System.Collections.ObjectModel.Collection<T>.Items
    System.Collections.ObjectModel.Collection<T>.System.Collections.Generic.ICollection<T>.IsReadOnly
    System.Collections.ObjectModel.Collection<T>.System.Collections.ICollection.IsSynchronized
    System.Collections.ObjectModel.Collection<T>.System.Collections.ICollection.SyncRoot
    System.Collections.ObjectModel.Collection<T>.System.Collections.IList.IsFixedSize
    System.Collections.ObjectModel.Collection<T>.System.Collections.IList.IsReadOnly
    System.Collections.ObjectModel.Collection<T>.System.Collections.IList.Item[System.Int32]
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: System.Collections.ObjectModel
    Assembly: Mapsui.UI.Forms.dll
    Syntax
    public class ObservableRangeCollection<T> : ObservableCollection<T>, IList<T>, ICollection<T>, IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IList, ICollection, IEnumerable, INotifyCollectionChanged, INotifyPropertyChanged
    Type Parameters
    Name Description
    T

    Constructors

    | Improve this Doc View Source

    ObservableRangeCollection()

    Initializes a new instance of ObservableCollection that is empty and has default initial capacity.

    Declaration
    public ObservableRangeCollection()
    | Improve this Doc View Source

    ObservableRangeCollection(IEnumerable<T>)

    Initializes a new instance of the ObservableCollection class that contains elements copied from the specified collection and has sufficient capacity to accommodate the number of elements copied.

    Declaration
    public ObservableRangeCollection(IEnumerable<T> collection)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> collection

    The collection whose elements are copied to the new list.

    Remarks

    The elements are copied onto the ObservableCollection in the same order they are read by the enumerator of the collection.

    Exceptions
    Type Condition
    System.ArgumentNullException

    collection is a null reference

    | Improve this Doc View Source

    ObservableRangeCollection(List<T>)

    Initializes a new instance of the ObservableCollection class that contains elements copied from the specified list

    Declaration
    public ObservableRangeCollection(List<T> list)
    Parameters
    Type Name Description
    System.Collections.Generic.List<T> list

    The list whose elements are copied to the new list.

    Remarks

    The elements are copied onto the ObservableCollection in the same order they are read by the enumerator of the list.

    Exceptions
    Type Condition
    System.ArgumentNullException

    list is a null reference

    Methods

    | Improve this Doc View Source

    AddRange(IEnumerable<T>)

    Adds the elements of the specified collection to the end of the System.Collections.ObjectModel.ObservableCollection<T>.

    Declaration
    public void AddRange(IEnumerable<T> collection)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> collection

    The collection whose elements should be added to the end of the System.Collections.ObjectModel.ObservableCollection<T>. The collection itself cannot be null, but it can contain elements that are null, if type T is a reference type.

    Exceptions
    Type Condition
    System.ArgumentNullException

    collection is null.

    | Improve this Doc View Source

    ClearItems()

    Called by base class Collection<T> when the list is being cleared; raises a CollectionChanged event to any listeners.

    Declaration
    protected override void ClearItems()
    Overrides
    System.Collections.ObjectModel.ObservableCollection<T>.ClearItems()
    | Improve this Doc View Source

    DeferEvents()

    Declaration
    protected virtual IDisposable DeferEvents()
    Returns
    Type Description
    System.IDisposable
    | Improve this Doc View Source

    InsertRange(Int32, IEnumerable<T>)

    Declaration
    public void InsertRange(int index, IEnumerable<T> collection)
    Parameters
    Type Name Description
    System.Int32 index
    System.Collections.Generic.IEnumerable<T> collection
    | Improve this Doc View Source

    OnCollectionChanged(NotifyCollectionChangedEventArgs)

    Raise CollectionChanged event to any listeners. Properties/methods modifying this ObservableCollection will raise a collection changed event through this virtual method.

    Declaration
    protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
    Parameters
    Type Name Description
    System.Collections.Specialized.NotifyCollectionChangedEventArgs e
    Overrides
    System.Collections.ObjectModel.ObservableCollection<T>.OnCollectionChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs)
    Remarks

    When overriding this method, either call its base implementation or call to guard against reentrant collection changes.

    | Improve this Doc View Source

    RemoveAll(Int32, Int32, Predicate<T>)

    Iterates over the specified range within the collection and removes all items that satisfy the specified match.

    Declaration
    public int RemoveAll(int index, int count, Predicate<T> match)
    Parameters
    Type Name Description
    System.Int32 index

    The index of where to start performing the search.

    System.Int32 count

    The number of items to iterate on.

    System.Predicate<T> match
    Returns
    Type Description
    System.Int32

    Returns the number of elements that where

    Remarks

    The complexity is O(n).

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    index is out of range.

    System.ArgumentOutOfRangeException

    count is out of range.

    System.ArgumentNullException

    match is null.

    | Improve this Doc View Source

    RemoveAll(Predicate<T>)

    Iterates over the collection and removes all items that satisfy the specified match.

    Declaration
    public int RemoveAll(Predicate<T> match)
    Parameters
    Type Name Description
    System.Predicate<T> match
    Returns
    Type Description
    System.Int32

    Returns the number of elements that where

    Remarks

    The complexity is O(n).

    Exceptions
    Type Condition
    System.ArgumentNullException

    match is null.

    | Improve this Doc View Source

    RemoveRange(IEnumerable<T>)

    Removes the first occurence of each item in the specified collection from the System.Collections.ObjectModel.ObservableCollection<T>.

    Declaration
    public void RemoveRange(IEnumerable<T> collection)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> collection

    The items to remove.

    Exceptions
    Type Condition
    System.ArgumentNullException

    collection is null.

    | Improve this Doc View Source

    RemoveRange(Int32, Int32)

    Removes a range of elements from the System.Collections.ObjectModel.ObservableCollection<T>>.

    Declaration
    public void RemoveRange(int index, int count)
    Parameters
    Type Name Description
    System.Int32 index

    The zero-based starting index of the range of elements to remove.

    System.Int32 count

    The number of elements to remove.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    The specified range is exceeding the collection.

    | Improve this Doc View Source

    ReplaceRange(IEnumerable<T>)

    Clears the current collection and replaces it with the specified collection, using the default System.Collections.Generic.EqualityComparer`1.

    Declaration
    public void ReplaceRange(IEnumerable<T> collection)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> collection

    The items to fill the collection with, after clearing it.

    Exceptions
    Type Condition
    System.ArgumentNullException

    collection is null.

    | Improve this Doc View Source

    ReplaceRange(IEnumerable<T>, IEqualityComparer<T>)

    Clears the current collection and replaces it with the specified collection, using the specified comparer to skip equal items.

    Declaration
    public void ReplaceRange(IEnumerable<T> collection, IEqualityComparer<T> comparer)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> collection

    The items to fill the collection with, after clearing it.

    System.Collections.Generic.IEqualityComparer<T> comparer

    An System.Collections.Generic.IEqualityComparer<T> to be used to check whether an item in the same location already existed before, which in case it would not be added to the collection, and no event will be raised for it.

    Exceptions
    Type Condition
    System.ArgumentNullException

    collection is null.

    System.ArgumentNullException

    comparer is null.

    | Improve this Doc View Source

    ReplaceRange(Int32, Int32, IEnumerable<T>)

    Removes the specified range and inserts the specified collection, ignoring equal items (using System.Collections.Generic.EqualityComparer`1.Default).

    Declaration
    public void ReplaceRange(int index, int count, IEnumerable<T> collection)
    Parameters
    Type Name Description
    System.Int32 index

    The index of where to start the replacement.

    System.Int32 count

    The number of items to be replaced.

    System.Collections.Generic.IEnumerable<T> collection

    The collection to insert in that location.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    index is out of range.

    System.ArgumentOutOfRangeException

    count is out of range.

    System.ArgumentNullException

    collection is null.

    | Improve this Doc View Source

    ReplaceRange(Int32, Int32, IEnumerable<T>, IEqualityComparer<T>)

    Removes the specified range and inserts the specified collection in its position, leaving equal items in equal positions intact.

    Declaration
    public void ReplaceRange(int index, int count, IEnumerable<T> collection, IEqualityComparer<T> comparer)
    Parameters
    Type Name Description
    System.Int32 index

    The index of where to start the replacement.

    System.Int32 count

    The number of items to be replaced.

    System.Collections.Generic.IEnumerable<T> collection

    The collection to insert in that location.

    System.Collections.Generic.IEqualityComparer<T> comparer

    The comparer to use when checking for equal items.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    index is out of range.

    System.ArgumentOutOfRangeException

    count is out of range.

    System.ArgumentNullException

    collection is null.

    System.ArgumentNullException

    comparer is null.

    | Improve this Doc View Source

    SetItem(Int32, T)

    Called by base class Collection<T> when an item is set in list; raises a CollectionChanged event to any listeners.

    Declaration
    protected override void SetItem(int index, T item)
    Parameters
    Type Name Description
    System.Int32 index
    T item
    Overrides
    System.Collections.ObjectModel.ObservableCollection<T>.SetItem(System.Int32, T)

    Implements

    System.Collections.Generic.IList<T>
    System.Collections.Generic.ICollection<T>
    System.Collections.Generic.IReadOnlyList<T>
    System.Collections.Generic.IReadOnlyCollection<T>
    System.Collections.Generic.IEnumerable<T>
    System.Collections.IList
    System.Collections.ICollection
    System.Collections.IEnumerable
    System.Collections.Specialized.INotifyCollectionChanged
    System.ComponentModel.INotifyPropertyChanged
    • Improve this Doc
    • View Source
    Back to top Generated by DocFX