docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method GetEnumerator

    GetEnumerator()

    Returns an enumerator that iterates through of this array. See the IEnumerable docs for more info: https://docs.microsoft.com/en-us/dotnet/api/system.collections.ienumerable

    Declaration
    public DynamicArray<T>.Iterator GetEnumerator()
    Returns
    Type Description
    DynamicArray<T>.Iterator

    Iterator pointing before the first element in the array.

    Remarks

    The returned struct intentionally does not explicitly implement the IEnumarable/IEnumerator interfaces it just follows the same function signatures. This means the duck typing used by foreach on the compiler level will pick it up as IEnumerable but at the same time avoids generating Garbage. For more info, see the C# language specification of the foreach statement.

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