Method IndexOf
IndexOf<T, U>(NativeArray<T>, U)
Finds the index of the first occurrence of a particular value in this array.
Declaration
public static int IndexOf<T, U>(this NativeArray<T> array, U value) where T : unmanaged, IEquatable<U>
Parameters
| Type | Name | Description |
|---|---|---|
| NativeArray<T> | array | The array to search. |
| U | value | The value to locate. |
Returns
| Type | Description |
|---|---|
| int | The index of the first occurrence of the value in this array. Returns -1 if no occurrence is found. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of elements in this array. |
| U | The value type. |
IndexOf<T, U>(ReadOnly, U)
Finds the index of the first occurrence of a particular value in this array.
Declaration
public static int IndexOf<T, U>(this NativeArray<T>.ReadOnly array, U value) where T : unmanaged, IEquatable<U>
Parameters
| Type | Name | Description |
|---|---|---|
| NativeArray<T>.ReadOnly | array | The array to search. |
| U | value | The value to locate. |
Returns
| Type | Description |
|---|---|
| int | The index of the first occurrence of the value in this array. Returns -1 if no occurrence is found. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of elements in this array. |
| U | The type of value to locate. |
IndexOf<T, U>(void*, int, U)
Finds the index of the first occurrence of a particular value in a buffer.
Declaration
public static int IndexOf<T, U>(void* ptr, int length, U value) where T : unmanaged, IEquatable<U>
Parameters
| Type | Name | Description |
|---|---|---|
| void* | ptr | A buffer. |
| int | length | Number of elements in the buffer. |
| U | value | The value to locate. |
Returns
| Type | Description |
|---|---|
| int | The index of the first occurrence of the value in the buffer. Returns -1 if no occurrence is found. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of elements in the buffer. |
| U | The value type. |