Class SdkGuard

Sdk Guard.

Inheritance
object
SdkGuard
Namespace: StylelabsStylelabs.MSdkUtilities
Assembly: Stylelabs.M.Sdk.dll
Syntax
RequestResponse
public static class SdkGuard

Methods

GreaterThan(string, long, long)

Checks if the specified long is greater than a given minimum. Otherwise if the specified long is lower or equal to given minimum, fail.

Declaration
RequestResponse
public static void GreaterThan(string argument, long value, long minimum)
Parameters
TypeNameDescription
stringargument

The name of the argument.

longvalue

The value of the argument.

longminimum

The minimum.

NotNegative(string, long)

Checks if the specified long is negative.

Declaration
RequestResponse
public static void NotNegative(string argument, long value)
Parameters
TypeNameDescription
stringargument

The name of the argument.

longvalue

The value of the argument.

NotNull(string, object)

Checks if the specified value is null.

Declaration
RequestResponse
public static void NotNull(string argument, object value)
Parameters
TypeNameDescription
stringargument

The name of the argument.

objectvalue

The value of the argument.

NotNullEach<T>(string, T)

Checks if the specified collection is null or contains null values.

Declaration
RequestResponse
public static void NotNullEach<T>(string argument, T value) where T : IEnumerable
Parameters
TypeNameDescription
stringargument

The name of the argument.

Tvalue

The value of the argument.

Type Parameters
NameDescription
T

Type of the collection.

NotNullMaxItems<T>(string, IEnumerable<T>, int)

Checks that the specified items does not contain more than maxItems.

Declaration
RequestResponse
public static void NotNullMaxItems<T>(string parameterName, IEnumerable<T> items, int maxItems)
Parameters
TypeNameDescription
stringparameterName

Name of the parameter.

IEnumerable<>items

Collection to check.

intmaxItems

The maximum number of allowed items within the items collection.

Type Parameters
NameDescription
T

The type parameter.

NotNullMaxOneId(string, IEnumerable<long>)

The ids cannot be null. It can be empty, but it cannot contain more than 1 value. The value must be a strictly positive id, if it exists.

Declaration
RequestResponse
public static void NotNullMaxOneId(string parameterName, IEnumerable<long> ids)
Parameters
TypeNameDescription
stringparameterName

Name of the parameter.

IEnumerable<>longids

Collection to check.

NotNullOrEmptyCollection<T>(string, T)

Checks if the specified collection is null or empty.

Declaration
RequestResponse
public static void NotNullOrEmptyCollection<T>(string argument, T value) where T : IEnumerable
Parameters
TypeNameDescription
stringargument

The name of the argument.

Tvalue

The value of the argument.

Type Parameters
NameDescription
T

Type of the collection.

NotNullOrInvariantCulture(string, CultureInfo)

Checks if the specified culture is null or invariant culture.

Declaration
RequestResponse
public static void NotNullOrInvariantCulture(string argument, CultureInfo culture)
Parameters
TypeNameDescription
stringargument

The name of the argument.

CultureInfoculture

The culture.

NotNullOrInvariantCultureEach(string, IEnumerable<CultureInfo>)

Checks if the specified culture is null or invariant culture.

Declaration
RequestResponse
public static void NotNullOrInvariantCultureEach(string argument, IEnumerable<CultureInfo> cultures)
Parameters
TypeNameDescription
stringargument

The name of the argument.

IEnumerable<>CultureInfocultures

The cultures.

NotNullOrWhiteSpace(string, string)

Checks if the specified value is null, an empty string or white space string.

Declaration
RequestResponse
public static void NotNullOrWhiteSpace(string argument, string value)
Parameters
TypeNameDescription
stringargument

The name of the argument.

stringvalue

The value of the argument.

NotNullOrWhiteSpaceEach(string, IEnumerable<string>)

Checks if the specified collection is null or contains null or white space strings.

Declaration
RequestResponse
public static void NotNullOrWhiteSpaceEach(string argument, IEnumerable<string> value)
Parameters
TypeNameDescription
stringargument

The name of the argument.

IEnumerable<>stringvalue

The value of the argument.

StrictlyPositive(string, int)

Checks if the specified number is strictly positive, i.e. greater than zero.

Declaration
RequestResponse
public static void StrictlyPositive(string argument, int value)
Parameters
TypeNameDescription
stringargument

The name of the argument.

intvalue

The value of the argument.

StrictlyPositive(string, TimeSpan)

Checks if the specified time span is strictly positive, i.e. greater than zero.

Declaration
RequestResponse
public static void StrictlyPositive(string argument, TimeSpan value)
Parameters
TypeNameDescription
stringargument

The name of the argument.

TimeSpanvalue

The value of the argument.

ValidId(string, long?)

If the id is not null, it must be strictly positive.

Declaration
RequestResponse
public static void ValidId(string parameterName, long? id)
Parameters
TypeNameDescription
stringparameterName

Name of the parameter.

longid

Id to check.

ValidIds(string, IEnumerable<long>)

The ids cannot be null, and every id must be strictly positive.

Declaration
RequestResponse
public static void ValidIds(string parameterName, IEnumerable<long> ids)
Parameters
TypeNameDescription
stringparameterName

Name of the parameter.

IEnumerable<>longids

Ids to check.

Do you have some feedback for us?

If you have suggestions for improving this article,