Requires.NotNullOrEmpty Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
NotNullOrEmpty(IEnumerable, String) |
Throws an exception if the specified parameter's value is null, has no elements. |
NotNullOrEmpty(String, String) |
Throws an exception if the specified parameter's value is null or empty. |
NotNullOrEmpty<T>(ICollection<T>, String) |
Throws an exception if the specified parameter's value is null, has no elements. |
NotNullOrEmpty<T>(IEnumerable<T>, String) |
Throws an exception if the specified parameter's value is null, has no elements. |
NotNullOrEmpty(IEnumerable, String)
Throws an exception if the specified parameter's value is null, has no elements.
public:
static void NotNullOrEmpty(System::Collections::IEnumerable ^ values, System::String ^ parameterName);
[System.Diagnostics.DebuggerStepThrough]
public static void NotNullOrEmpty (System.Collections.IEnumerable values, string? parameterName);
[System.Diagnostics.DebuggerStepThrough]
public static void NotNullOrEmpty (System.Collections.IEnumerable values, string? parameterName = default);
[<System.Diagnostics.DebuggerStepThrough>]
static member NotNullOrEmpty : System.Collections.IEnumerable * string -> unit
Public Shared Sub NotNullOrEmpty (values As IEnumerable, parameterName As String)
Public Shared Sub NotNullOrEmpty (values As IEnumerable, Optional parameterName As String = Nothing)
Parameters
- values
- IEnumerable
The value of the argument.
- parameterName
- String
The name of the parameter to include in any thrown exception. If this argument is omitted (explicitly writing null
does not qualify), the expression used in the first argument will be used as the parameter name.
- Attributes
Exceptions
Thrown if the tested condition is false.
Applies to
NotNullOrEmpty(String, String)
Throws an exception if the specified parameter's value is null or empty.
public:
static void NotNullOrEmpty(System::String ^ value, System::String ^ parameterName);
[System.Diagnostics.DebuggerStepThrough]
public static void NotNullOrEmpty (string value, string? parameterName);
[System.Diagnostics.DebuggerStepThrough]
public static void NotNullOrEmpty (string value, string? parameterName = default);
[<System.Diagnostics.DebuggerStepThrough>]
static member NotNullOrEmpty : string * string -> unit
Public Shared Sub NotNullOrEmpty (value As String, parameterName As String)
Public Shared Sub NotNullOrEmpty (value As String, Optional parameterName As String = Nothing)
Parameters
- value
- String
The value of the argument.
- parameterName
- String
The name of the parameter to include in any thrown exception. If this argument is omitted (explicitly writing null
does not qualify), the expression used in the first argument will be used as the parameter name.
- Attributes
Exceptions
Thrown if value
is null
or empty.
Applies to
NotNullOrEmpty<T>(ICollection<T>, String)
Throws an exception if the specified parameter's value is null, has no elements.
public:
generic <typename T>
static void NotNullOrEmpty(System::Collections::Generic::ICollection<T> ^ values, System::String ^ parameterName);
[System.Diagnostics.DebuggerStepThrough]
public static void NotNullOrEmpty<T> (System.Collections.Generic.ICollection<T> values, string? parameterName = default);
[<System.Diagnostics.DebuggerStepThrough>]
static member NotNullOrEmpty : System.Collections.Generic.ICollection<'T> * string -> unit
Public Shared Sub NotNullOrEmpty(Of T) (values As ICollection(Of T), Optional parameterName As String = Nothing)
Type Parameters
- T
The type of value in the collection.
Parameters
- values
- ICollection<T>
The value of the argument.
- parameterName
- String
The name of the parameter to include in any thrown exception. If this argument is omitted (explicitly writing null
does not qualify), the expression used in the first argument will be used as the parameter name.
- Attributes
Exceptions
Thrown if the tested condition is false.
Applies to
NotNullOrEmpty<T>(IEnumerable<T>, String)
Throws an exception if the specified parameter's value is null, has no elements.
public:
generic <typename T>
static void NotNullOrEmpty(System::Collections::Generic::IEnumerable<T> ^ values, System::String ^ parameterName);
[System.Diagnostics.DebuggerStepThrough]
public static void NotNullOrEmpty<T> (System.Collections.Generic.IEnumerable<T> values, string? parameterName);
[System.Diagnostics.DebuggerStepThrough]
public static void NotNullOrEmpty<T> (System.Collections.Generic.IEnumerable<T> values, string? parameterName = default);
[<System.Diagnostics.DebuggerStepThrough>]
static member NotNullOrEmpty : seq<'T> * string -> unit
Public Shared Sub NotNullOrEmpty(Of T) (values As IEnumerable(Of T), parameterName As String)
Public Shared Sub NotNullOrEmpty(Of T) (values As IEnumerable(Of T), Optional parameterName As String = Nothing)
Type Parameters
- T
The type produced by the enumeration.
Parameters
- values
- IEnumerable<T>
The value of the argument.
- parameterName
- String
The name of the parameter to include in any thrown exception. If this argument is omitted (explicitly writing null
does not qualify), the expression used in the first argument will be used as the parameter name.
- Attributes
Exceptions
Thrown if the tested condition is false.