docs.unity3d.com
Search Results for

    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.

    In This Article
    • IsNotNull<T>(T)
    • IsNotNull<T>(T, string)
    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)