docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method IndexOf

    IndexOf(T, int, int)

    Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the DynamicArray that starts at the specified index and contains the specified number of elements.

    Declaration
    public int IndexOf(T item, int index, int count)
    Parameters
    Type Name Description
    T item

    The object to locate in the DynamicArray. The value can be null for reference types.

    int index

    The zero-based starting index of the search. 0 (zero) is valid in an empty list.

    int count

    The number of elements in the section to search.

    Returns
    Type Description
    int

    IndexOf(T, int)

    Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the DynamicArray that extends from the specified index to the last element.

    Declaration
    public int IndexOf(T item, int index)
    Parameters
    Type Name Description
    T item

    The object to locate in the DynamicArray. The value can be null for reference types.

    int index

    The zero-based starting index of the search. 0 (zero) is valid in an empty list.

    Returns
    Type Description
    int

    The zero-based index of the first occurrence of item within the range of elements in the DynamicArray that extends from index to the last element, if found; otherwise, -1.

    IndexOf(T)

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

    Declaration
    public int IndexOf(T item)
    Parameters
    Type Name Description
    T item

    The object to locate in the DynamicArray. The value can be null for reference types.

    Returns
    Type Description
    int

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

    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)