docs.unity.cn
    Show / Hide Table of Contents

    Method IsNotNull

    IsNotNull<T>(T)

    Assert that a value is not a null reference. Throws an exception if the assertion fails.

    Declaration
    [Conditional("UNITY_ASSERTIONS")]
    public static void IsNotNull<T>(T value)
        where T : class
    Parameters
    Type Name Description
    T value

    The value that the caller expects to be a non-null reference to T.

    Type Parameters
    Name Description
    T

    The type of the object being tested.

    IsNotNull<T>(T, String)

    Assert that a value is not a null reference. Throws an exception if the assertion fails.

    Declaration
    [Conditional("UNITY_ASSERTIONS")]
    public static void IsNotNull<T>(T value, string message)
        where T : class
    Parameters
    Type Name Description
    T value

    The value that the caller expects to be a non-null reference to T.

    String message

    If the assertion fails, this message will be logged.

    Type Parameters
    Name Description
    T

    The type of the object being tested.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023