docs.unity.cn
    Show / Hide Table of Contents

    Class NativeListExtensions

    Provides extension methods for UnsafeList.

    Inheritance
    Object
    NativeListExtensions
    Namespace: Unity.Collections
    Syntax
    public static class NativeListExtensions

    Methods

    ArraysEqual<T>(NativeArray<T>, in NativeList<T>)

    Returns true if this container and another have equal length and content.

    Declaration
    public static bool ArraysEqual<T>(this NativeArray<T> container, in NativeList<T> other)
        where T : struct, IEquatable<T>
    Parameters
    Type Name Description
    NativeArray<T> container

    The container to compare for equality.

    NativeList<T> other

    The other container to compare for equality.

    Returns
    Type Description
    Boolean

    True if the containers have equal length and content.

    Type Parameters
    Name Description
    T

    The type of the source container's elements.

    ArraysEqual<T>(NativeList<T>, in UnsafeList<T>)

    Returns true if this container and another have equal length and content.

    Declaration
    public static bool ArraysEqual<T>(this NativeList<T> container, in UnsafeList<T> other)
        where T : struct, IEquatable<T>
    Parameters
    Type Name Description
    NativeList<T> container

    The container to compare for equality.

    UnsafeList<T> other

    The other container to compare for equality.

    Returns
    Type Description
    Boolean

    True if the containers have equal length and content.

    Type Parameters
    Name Description
    T

    The type of the source container's elements.

    ArraysEqual<T>(NativeList<T>, in NativeArray<T>)

    Returns true if this container and another have equal length and content.

    Declaration
    public static bool ArraysEqual<T>(this NativeList<T> container, in NativeArray<T> other)
        where T : struct, IEquatable<T>
    Parameters
    Type Name Description
    NativeList<T> container

    The container to compare for equality.

    NativeArray<T> other

    The other container to compare for equality.

    Returns
    Type Description
    Boolean

    True if the containers have equal length and content.

    Type Parameters
    Name Description
    T

    The type of the source container's elements.

    ArraysEqual<T>(NativeList<T>, in NativeList<T>)

    Returns true if this container and another have equal length and content.

    Declaration
    public static bool ArraysEqual<T>(this NativeList<T> container, in NativeList<T> other)
        where T : struct, IEquatable<T>
    Parameters
    Type Name Description
    NativeList<T> container

    The container to compare for equality.

    NativeList<T> other

    The other container to compare for equality.

    Returns
    Type Description
    Boolean

    True if the containers have equal length and content.

    Type Parameters
    Name Description
    T

    The type of the source container's elements.

    Contains<T, U>(NativeList<T>, U)

    Returns true if a particular value is present in this list.

    Declaration
    public static bool Contains<T, U>(this NativeList<T> list, U value)
        where T : struct, IEquatable<U>
    Parameters
    Type Name Description
    NativeList<T> list

    The list to search.

    U value

    The value to locate.

    Returns
    Type Description
    Boolean

    True if the value is present in this list.

    Type Parameters
    Name Description
    T

    The type of elements in this list.

    U

    The value type.

    IndexOf<T, U>(NativeList<T>, U)

    Finds the index of the first occurrence of a particular value in this list.

    Declaration
    public static int IndexOf<T, U>(this NativeList<T> list, U value)
        where T : struct, IEquatable<U>
    Parameters
    Type Name Description
    NativeList<T> list

    The list to search.

    U value

    The value to locate.

    Returns
    Type Description
    Int32

    The index of the first occurrence of the value in this list. Returns -1 if no occurrence is found.

    Type Parameters
    Name Description
    T

    The type of elements in the list.

    U

    The value type.

    Back to top Copyright © 2023 Unity Technologies — Terms of use
    Generated by DocFX
    on Thursday, May 11, 2023