docs.unity.cn
Search Results for

    Show / Hide Table of Contents

    Class CollectionPool<TCollection, TValue>

    A pool of collection objects for avoiding allocations when new empty collections are needed frequently.

    Inheritance
    object
    CollectionPool<TCollection, TValue>
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Unity.XR.CoreUtils
    Assembly: solution.dll
    Syntax
    public static class CollectionPool<TCollection, TValue> where TCollection : ICollection<TValue>, new()
    Type Parameters
    Name Description
    TCollection

    The desired type of collection.

    TValue

    The value type of the ICollection specified in TCollection.

    Methods

    Name Description
    GetCollection()

    Gets a collection of the given type from the pool. Creates a new collection object if the pool is empty.

    RecycleCollection(TCollection)

    Returns a collection to the pool. The collection is cleared.

    In This Article
    Back to top
    Copyright © 2024 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)