docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method Swap

    Swap<T>(ref T, ref T)

    Swaps the values of the given arguments.

    Declaration
    public static void Swap<T>(ref T a, ref T b)
    Parameters
    Type Name Description
    T a

    First value.

    T b

    Second value.

    Type Parameters
    Name Description
    T

    Any type. Works both for value types and reference types.

    In This Article
    Back to top
    Copyright © 2024 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)