Show / Hide Table of Contents

Class Requires

Provides contract checks.

Inheritance
System.Object
Requires
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: Kephas.Diagnostics.Contracts
Assembly: Kephas.Core.dll
Syntax
public static class Requires

Methods

| Improve this Doc View Source

NotNull<T>(T, String)

Requires that the argument is not null.

Declaration
[ContractArgumentValidator]
public static void NotNull<T>(T value, string parameterName)

    where T : class
Parameters
Type Name Description
T value

The value.

System.String parameterName

Name of the parameter.

Type Parameters
Name Description
T

The argument type.

Exceptions
Type Condition
System.ArgumentNullException

Thrown when the required argument is null.

| Improve this Doc View Source

NotNull<T>(Nullable<T>, String)

Requires that the argument is not null.

Declaration
[ContractArgumentValidator]
public static void NotNull<T>(T? value, string parameterName)

    where T : struct
Parameters
Type Name Description
System.Nullable<T> value

The value.

System.String parameterName

Name of the parameter.

Type Parameters
Name Description
T

The argument type.

Exceptions
Type Condition
System.ArgumentNullException

Thrown when the required argument is null.

| Improve this Doc View Source

NotNullOrEmpty(String, String)

Requires that the argument is not null or empty.

Declaration
[ContractArgumentValidator]
public static void NotNullOrEmpty(string value, string parameterName)
Parameters
Type Name Description
System.String value

The value.

System.String parameterName

Name of the parameter.

Exceptions
Type Condition
System.ArgumentException

Thrown when the required argument is null or empty.

| Improve this Doc View Source

NotNullOrEmpty<T>(T[], String)

Requires that the argument is not null or empty.

Declaration
[ContractArgumentValidator]
public static void NotNullOrEmpty<T>(T[] value, string parameterName)
Parameters
Type Name Description
T[] value

The value.

System.String parameterName

Name of the parameter.

Type Parameters
Name Description
T

The argument type.

Exceptions
Type Condition
System.ArgumentNullException

Thrown when the required argument is null.

System.ArgumentException

Thrown when the required argument is empty.

| Improve this Doc View Source

NotNullOrEmpty<T>(ICollection<T>, String)

Requires that the argument is not null or empty.

Declaration
[ContractArgumentValidator]
public static void NotNullOrEmpty<T>(ICollection<T> value, string parameterName)
Parameters
Type Name Description
System.Collections.Generic.ICollection<T> value

The value.

System.String parameterName

Name of the parameter.

Type Parameters
Name Description
T

The array item type.

Exceptions
Type Condition
System.ArgumentNullException

Thrown when the required argument is null.

System.ArgumentException

Thrown when the required argument is empty.

| Improve this Doc View Source

NotNullOrEmpty<T>(IEnumerable<T>, String)

Requires that the argument is not null or empty.

Declaration
[ContractArgumentValidator]
public static void NotNullOrEmpty<T>(IEnumerable<T> value, string parameterName)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<T> value

The value.

System.String parameterName

Name of the parameter.

Type Parameters
Name Description
T

The array item type.

Exceptions
Type Condition
System.ArgumentNullException

Thrown when the required argument is null.

System.ArgumentException

Thrown when the required argument is empty.

  • Improve this Doc
  • View Source
Back to top Generated by DocFX