{!See https://docs.google.com/document/d/1takg_GmIBBKKTj-GHZCwzxohpQz7Bhekivkk72kYMtE/edit for reference implementation of OneTrust, dataLayer and GTM} {!OneTrust Cookies Consent} {!OneTrust Cookies Consent end} {!dataLayer initialization push} {!dataLayer initialization push end} {!Google Tag Manager} {!Google Tag Manager end} Method RemoveSwapBack | Collections | 2.3.0-pre.3
docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method RemoveSwapBack

    RemoveSwapBack<T>(List<T>, T)

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

    Declaration
    public static bool RemoveSwapBack<T>(this List<T> list, T value)
    Parameters
    Type Name Description
    List<T> list

    The list to search.

    T value

    The value to locate and remove.

    Returns
    Type Description
    bool

    Returns true if an element was removed.

    Type Parameters
    Name Description
    T

    The type of elements in the list.

    Remarks

    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.

    RemoveSwapBack<T>(List<T>, Predicate<T>)

    Finds and removes the first value which satisfies a predicate.

    Declaration
    public static bool RemoveSwapBack<T>(this List<T> list, Predicate<T> matcher)
    Parameters
    Type Name Description
    List<T> list

    The list to search.

    Predicate<T> matcher

    The predicate for testing the elements of the list.

    Returns
    Type Description
    bool

    Returns true if an element was removed.

    Type Parameters
    Name Description
    T

    The type of elements in the list.

    Remarks

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

    In This Article
    • RemoveSwapBack<T>(List<T>, T)
    • RemoveSwapBack<T>(List<T>, Predicate<T>)
    Back to top
    Copyright © 2023 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)