<PackageReference Include="OpenTelemetry.Api" Version="1.13.0" />

OpenTelemetry.Internal.Guard

static class Guard
Methods for guarding against exception throwing values.
public static void ThrowIfInvalidTimeout(int value, string paramName = null)

Throw an exception if the value is not considered a valid timeout.

public static T ThrowIfNotOfType<T>(object value, string paramName = null)

Throw an exception if the value is not of the expected type.

public static void ThrowIfNull(object value, string paramName = null)

Throw an exception if the value is null.

public static void ThrowIfNullOrEmpty(string value, string paramName = null)

Throw an exception if the value is null or empty.

public static void ThrowIfNullOrWhitespace(string value, string paramName = null)

Throw an exception if the value is null or whitespace.

public static void ThrowIfOutOfRange(int value, string paramName = null, int min = -2147483648, int max = 2147483647, string minName = null, string maxName = null, string message = null)

Throw an exception if the value is not within the given range.

public static void ThrowIfOutOfRange(double value, string paramName = null, double min = -1.7976931348623157E+308, double max = 1.7976931348623157E+308, string minName = null, string maxName = null, string message = null)

Throw an exception if the value is not within the given range.

public static void ThrowIfZero(int value, string message = "Must not be zero", string paramName = null)

Throw an exception if the value is zero.