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

ListExtensions.RemoveSwapBack

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 bool RemoveSwapBack(List<T> list, T value);

Parameters

Parameter Description
list The list to search.
value The value to locate and remove.

Returns

bool Returns true if an element was removed.

Description

Finds and removes the first occurrence of a particular value in the list.

If found, the first occurrence of the value is overwritten by the last element of the list, and the list's length is decremented by one.


Declaration

public static bool RemoveSwapBack(List<T> list, Predicate<T> matcher);

Parameters

Parameter Description
list The list to search.
matcher The predicate for testing the elements of the list.

Returns

bool Returns true if an element was removed.

Description

Finds and removes the first value which satisfies a predicate.

The first value satisfying the predicate is overwritten by the last element of the list, and the list's length is decremented by one.