docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class CollectionWrapper<T>

    Represents an abstract collection of items. The items are stored internally as List. Implement your own concrete collections by inheriting from this class.

    Inheritance
    object
    CollectionWrapper
    CollectionWrapper<T>
    ComponentAddedCriterion.SerializedTypeCollection
    Tutorial.TutorialPageCollection
    TutorialParagraphCollection
    Implements
    IEnumerable<T>
    IEnumerable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.Tutorials.Core.Editor
    Assembly: Unity.Tutorials.Core.Editor.dll
    Syntax
    public abstract class CollectionWrapper<T> : CollectionWrapper, IEnumerable<T>, IEnumerable
    Type Parameters
    Name Description
    T

    The type of elements in the collection.

    Constructors

    CollectionWrapper()

    Default-constructs an empty collection.

    Declaration
    public CollectionWrapper()

    CollectionWrapper(IList<T>)

    Constructs with items.

    Declaration
    public CollectionWrapper(IList<T> items)
    Parameters
    Type Name Description
    IList<T> items

    The List of item this CollectionWrapper will initially contain

    Properties

    Count

    The count of items.

    Declaration
    public int Count { get; }
    Property Value
    Type Description
    int

    this[int]

    Set or get the item at index i

    Declaration
    public T this[int i] { get; set; }
    Parameters
    Type Name Description
    int i

    The index of the requested item

    Property Value
    Type Description
    T

    Methods

    AddItem(T)

    Adds an item to the collection

    Declaration
    public void AddItem(T item)
    Parameters
    Type Name Description
    T item

    The item to add to the Collection

    GetEnumerator()

    Returns an Enumerator to the items.

    Declaration
    public IEnumerator<T> GetEnumerator()
    Returns
    Type Description
    IEnumerator<T>

    An IEnumerator on the items array

    GetItems(List<T>)

    Returns the items of the collection as a list.

    Declaration
    public void GetItems(List<T> items)
    Parameters
    Type Name Description
    List<T> items

    The List to which the containing items will be added to. This List is cleared before insertion!

    SetItems(IEnumerable<T>)

    Sets the items of the collection.

    Declaration
    public void SetItems(IEnumerable<T> items)
    Parameters
    Type Name Description
    IEnumerable<T> items

    The List that contained the item that will be added to this Collection. The Collection is cleared before insertion!

    Implements

    IEnumerable<T>
    IEnumerable
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)