Search Results for

    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
    object
    Collection<T>
    ObservableCollection<T>
    ObservableRangeCollection<T>
    Implements
    IList<T>
    ICollection<T>
    IReadOnlyList<T>
    IReadOnlyCollection<T>
    IEnumerable<T>
    IList
    ICollection
    IEnumerable
    INotifyCollectionChanged
    INotifyPropertyChanged
    Inherited Members
    ObservableCollection<T>.BlockReentrancy()
    ObservableCollection<T>.CheckReentrancy()
    ObservableCollection<T>.InsertItem(int, T)
    ObservableCollection<T>.Move(int, int)
    ObservableCollection<T>.MoveItem(int, int)
    ObservableCollection<T>.OnPropertyChanged(PropertyChangedEventArgs)
    ObservableCollection<T>.RemoveItem(int)
    ObservableCollection<T>.CollectionChanged
    ObservableCollection<T>.PropertyChanged
    Collection<T>.Add(T)
    Collection<T>.Clear()
    Collection<T>.Contains(T)
    Collection<T>.CopyTo(T[], int)
    Collection<T>.GetEnumerator()
    Collection<T>.IndexOf(T)
    Collection<T>.Insert(int, T)
    Collection<T>.Remove(T)
    Collection<T>.RemoveAt(int)
    Collection<T>.Count
    Collection<T>.this[int]
    Collection<T>.Items
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Mapsui.Utilities
    Assembly: Mapsui.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 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.

    Constructors

    | Edit this page View Source

    ObservableRangeCollection()

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

    Declaration
    public ObservableRangeCollection()
    | Edit this page 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
    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
    ArgumentNullException

    collection is a null reference

    | Edit this page 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
    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
    ArgumentNullException

    list is a null reference

    Methods

    | Edit this page View Source

    AddRange(IEnumerable<T>)

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

    Declaration
    public void AddRange(IEnumerable<T> collection)
    Parameters
    Type Name Description
    IEnumerable<T> collection

    The collection whose elements should be added to the end of the 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
    ArgumentNullException

    collection is null.

    | Edit this page 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
    ObservableCollection<T>.ClearItems()
    | Edit this page View Source

    DeferEvents()

    Declaration
    protected virtual IDisposable DeferEvents()
    Returns
    Type Description
    IDisposable
    | Edit this page View Source

    InsertRange(int, IEnumerable<T>)

    Inserts the elements of a collection into the ObservableCollection<T> at the specified index.

    Declaration
    public void InsertRange(int index, IEnumerable<T> collection)
    Parameters
    Type Name Description
    int index

    The zero-based index at which the new elements should be inserted.

    IEnumerable<T> collection

    The collection whose elements should be inserted into the List{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
    ArgumentNullException

    collection is null.

    ArgumentOutOfRangeException

    index is not in the collection range.

    | Edit this page 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
    NotifyCollectionChangedEventArgs e
    Overrides
    ObservableCollection<T>.OnCollectionChanged(NotifyCollectionChangedEventArgs)
    Remarks

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

    | Edit this page View Source

    RemoveAll(int, int, 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
    int index

    The index of where to start performing the search.

    int count

    The number of items to iterate on.

    Predicate<T> match
    Returns
    Type Description
    int

    Returns the number of elements that where

    Remarks

    The complexity is O(n).

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    index is out of range.

    ArgumentOutOfRangeException

    count is out of range.

    ArgumentNullException

    match is null.

    | Edit this page 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
    Predicate<T> match
    Returns
    Type Description
    int

    Returns the number of elements that where

    Remarks

    The complexity is O(n).

    Exceptions
    Type Condition
    ArgumentNullException

    match is null.

    | Edit this page View Source

    RemoveRange(IEnumerable<T>)

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

    Declaration
    public void RemoveRange(IEnumerable<T> collection)
    Parameters
    Type Name Description
    IEnumerable<T> collection

    The items to remove.

    Exceptions
    Type Condition
    ArgumentNullException

    collection is null.

    | Edit this page View Source

    RemoveRange(int, int)

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

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

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

    int count

    The number of elements to remove.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    The specified range is exceeding the collection.

    | Edit this page View Source

    ReplaceRange(IEnumerable<T>)

    Clears the current collection and replaces it with the specified collection, using the default EqualityComparer<T>.

    Declaration
    public void ReplaceRange(IEnumerable<T> collection)
    Parameters
    Type Name Description
    IEnumerable<T> collection

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

    Exceptions
    Type Condition
    ArgumentNullException

    collection is null.

    | Edit this page 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
    IEnumerable<T> collection

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

    IEqualityComparer<T> comparer

    An 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
    ArgumentNullException

    collection is null.

    ArgumentNullException

    comparer is null.

    | Edit this page View Source

    ReplaceRange(int, int, IEnumerable<T>)

    Removes the specified range and inserts the specified collection, ignoring equal items (using Default).

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

    The index of where to start the replacement.

    int count

    The number of items to be replaced.

    IEnumerable<T> collection

    The collection to insert in that location.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    index is out of range.

    ArgumentOutOfRangeException

    count is out of range.

    ArgumentNullException

    collection is null.

    | Edit this page View Source

    ReplaceRange(int, int, 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
    int index

    The index of where to start the replacement.

    int count

    The number of items to be replaced.

    IEnumerable<T> collection

    The collection to insert in that location.

    IEqualityComparer<T> comparer

    The comparer to use when checking for equal items.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    index is out of range.

    ArgumentOutOfRangeException

    count is out of range.

    ArgumentNullException

    collection is null.

    ArgumentNullException

    comparer is null.

    | Edit this page View Source

    SetItem(int, 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
    int index
    T item
    Overrides
    ObservableCollection<T>.SetItem(int, T)

    Implements

    IList<T>
    ICollection<T>
    IReadOnlyList<T>
    IReadOnlyCollection<T>
    IEnumerable<T>
    IList
    ICollection
    IEnumerable
    INotifyCollectionChanged
    INotifyPropertyChanged
    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX