Show / Hide Table of Contents

    Class GrpcPreconditions

    Utility methods to simplify checking preconditions in the code.

    Inheritance
    System.Object
    GrpcPreconditions
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Grpc.Core.Utils
    Assembly: Grpc.Core.Api.dll
    Syntax
    public static class GrpcPreconditions

    Methods

    CheckArgument(Boolean)

    Throws System.ArgumentException if condition is false.

    Declaration
    public static void CheckArgument(bool condition)
    Parameters
    Type Name Description
    System.Boolean condition

    The condition.

    CheckArgument(Boolean, String)

    Throws System.ArgumentException with given message if condition is false.

    Declaration
    public static void CheckArgument(bool condition, string errorMessage)
    Parameters
    Type Name Description
    System.Boolean condition

    The condition.

    System.String errorMessage

    The error message.

    CheckNotNull<T>(T)

    Throws System.ArgumentNullException if reference is null.

    Declaration
    public static T CheckNotNull<T>(T reference)
    Parameters
    Type Name Description
    T reference

    The reference.

    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T

    CheckNotNull<T>(T, String)

    Throws System.ArgumentNullException if reference is null.

    Declaration
    public static T CheckNotNull<T>(T reference, string paramName)
    Parameters
    Type Name Description
    T reference

    The reference.

    System.String paramName

    The parameter name.

    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T

    CheckState(Boolean)

    Throws System.InvalidOperationException if condition is false.

    Declaration
    public static void CheckState(bool condition)
    Parameters
    Type Name Description
    System.Boolean condition

    The condition.

    CheckState(Boolean, String)

    Throws System.InvalidOperationException with given message if condition is false.

    Declaration
    public static void CheckState(bool condition, string errorMessage)
    Parameters
    Type Name Description
    System.Boolean condition

    The condition.

    System.String errorMessage

    The error message.

    Back to top Generated by DocFX