Version: Unity 6.7 Beta (6000.7)
LanguageEnglish
  • C#

NativeArrayExtensions.IndexOf

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public static int IndexOf(NativeArray<T> container, U value);

Parameters

Parameter Description
container The container to search.
value The value to locate.

Returns

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

Description

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


Declaration

public static int IndexOf(NativeList<T> container, U value);

Parameters

Parameter Description
container The container to search.
value The value to locate.

Returns

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

Description

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


Declaration

public static int IndexOf(T* ptr, int length, U value);

Parameters

Parameter Description
ptr A buffer.
length Number of elements in the buffer.
value The value to locate.

Returns

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

Description

Finds the index of the first occurrence of a particular value in a buffer.


Declaration

public static int IndexOf(ReadOnlySpan<T> roSpan, U value);

Parameters

Parameter Description
roSpan A ReadOnlySpan.
value The value to locate.

Returns

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

Description

Finds the index of the first occurrence of a particular value in a buffer.