GemBox.Presentation
  • Overview
  • Examples
  • Free version
  • Support
  • Pricelist

    Show / Hide Table of Contents

    Collection<T> Class

    Namespace:
    GemBox.Presentation
    Assembly:
    GemBox.Presentation.dll

    Represents a base type for all collection types in the GemBox.Presentation assembly.

    • C#
    • VB.NET
    public abstract class Collection<T> : Collection, IList, ICollection, IList<T>, ICollection<T>, IEnumerable<T>, IEnumerable
    Public MustInherit Class Collection(Of T)
        Inherits Collection
        Implements IList, ICollection, IList(Of T), ICollection(Of T), IEnumerable(Of T), IEnumerable
    Type Parameters
    T

    The type of elements in the collection.

    Inheritance:
    System.Object
    Collection
    Collection<T>
    Derived
    CommentCollection
    CustomSlideShowCollection
    CustomXmlPartCollection
    DrawingCollection
    GeometryGuideCollection
    GradientStopCollection
    MediaBookmarkCollection
    SlideObjectCollection<TSlide>
    TableElementCollection<T>
    TableStyleCollection
    TabStopCollection
    TextElementCollection
    TextParagraphCollection
    Implements
    System.Collections.IList
    System.Collections.ICollection
    System.Collections.Generic.IList<T>
    System.Collections.Generic.ICollection<T>
    System.Collections.Generic.IEnumerable<T>
    System.Collections.IEnumerable

    Properties

    Count

    Gets the number of Ts contained in the collection.

    • C#
    • VB.NET
    public int Count { get; }
    Public ReadOnly Property Count As Integer
    Property Value
    System.Int32

    The number of Ts contained in the collection.

    Item[Int32]

    Gets or sets the T at the specified index.

    • C#
    • VB.NET
    public T this[int index] { get; set; }
    Public Property Item(index As Integer) As T
    Parameters
    index
    System.Int32

    The zero-based index of the T to get or set.

    Property Value
    T

    The T at the specified index.

    Exceptions
    System.ArgumentOutOfRangeException

    index is less than zero or index is equal to or greater than Count.

    Methods

    Add(T)

    Adds a T to the end of the collection.

    • C#
    • VB.NET
    public void Add(T item)
    Public Sub Add(item As T)
    Parameters
    item
    T

    The T to be added to the end of the collection.

    Clear()

    Removes all Ts from the collection.

    • C#
    • VB.NET
    public void Clear()
    Public Sub Clear

    Contains(T)

    Determines whether a T is in the collection.

    • C#
    • VB.NET
    public bool Contains(T item)
    Public Function Contains(item As T) As Boolean
    Parameters
    item
    T

    The T to locate in the collection.

    Returns
    System.Boolean

    true if item is found in the collection; otherwise, false.

    GetEnumerator()

    Returns an enumerator that iterates through the collection.

    • C#
    • VB.NET
    public IEnumerator<T> GetEnumerator()
    Public Function GetEnumerator As IEnumerator(Of T)
    Returns
    System.Collections.Generic.IEnumerator<T>

    An System.Collections.Generic.IEnumerator<T> for the collection.

    IndexOf(T)

    Searches for the specified T and returns the zero-based index of the first occurrence within the entire collection.

    • C#
    • VB.NET
    public int IndexOf(T item)
    Public Function IndexOf(item As T) As Integer
    Parameters
    item
    T

    The T to locate in the collection.

    Returns
    System.Int32

    The zero-based index of the first occurrence of item within the entire collection, if found; otherwise, -1.

    Insert(Int32, T)

    Inserts a T to the collection at the specified index.

    • C#
    • VB.NET
    public void Insert(int index, T item)
    Public Sub Insert(index As Integer, item As T)
    Parameters
    index
    System.Int32

    The zero-based index at which T should be inserted.

    item
    T

    The T to insert into the collection.

    Exceptions
    System.ArgumentOutOfRangeException

    index is less than zero or index is equal to or greater than Count.

    Remove(T)

    Removes the first occurrence of a specific T from the collection.

    • C#
    • VB.NET
    public bool Remove(T item)
    Public Function Remove(item As T) As Boolean
    Parameters
    item
    T

    The T to remove from the collection.

    Returns
    System.Boolean

    true if item is successfully removed; otherwise, false. This method also returns false if item was not found in the original collection.

    RemoveAt(Int32)

    Removes the T at the specified index of the collection.

    • C#
    • VB.NET
    public void RemoveAt(int index)
    Public Sub RemoveAt(index As Integer)
    Parameters
    index
    System.Int32

    The zero-based index of the T to remove.

    Exceptions
    System.ArgumentOutOfRangeException

    index is less than zero or index is equal to or greater than Count.

    Implements

    System.Collections.IList
    System.Collections.ICollection
    System.Collections.Generic.IList<T>
    System.Collections.Generic.ICollection<T>
    System.Collections.Generic.IEnumerable<T>
    System.Collections.IEnumerable
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.