Class GrpcPreconditions (2.48.0)

public static class GrpcPreconditions : object

Utility methods to simplify checking preconditions in the code.

Inheritance

Object > GrpcPreconditions

Namespace

Grpc.Core.Utils

Assembly

Grpc.Core.Api.dll

Methods

CheckArgument(Boolean)

public static void CheckArgument(bool condition)

Throws if condition is false.

Parameter
Name Description
condition Boolean

The condition.

CheckArgument(Boolean, String)

public static void CheckArgument(bool condition, string errorMessage)

Throws with given message if condition is false.

Parameters
Name Description
condition Boolean

The condition.

errorMessage String

The error message.

CheckNotNull<T>(T)

public static T CheckNotNull<T>(T reference)

Throws if reference is null.

Parameter
Name Description
reference T

The reference.

Returns
Type Description
T
Type Parameter
Name Description
T

CheckNotNull<T>(T, String)

public static T CheckNotNull<T>(T reference, string paramName)

Throws if reference is null.

Parameters
Name Description
reference T

The reference.

paramName String

The parameter name.

Returns
Type Description
T
Type Parameter
Name Description
T

CheckState(Boolean)

public static void CheckState(bool condition)

Throws if condition is false.

Parameter
Name Description
condition Boolean

The condition.

CheckState(Boolean, String)

public static void CheckState(bool condition, string errorMessage)

Throws with given message if condition is false.

Parameters
Name Description
condition Boolean

The condition.

errorMessage String

The error message.