Requires.NotDefault<T>(T, String) 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.
Throws an ArgumentException if the specified parameter's value is equal to the
default value of the TypeT
.
public:
generic <typename T>
where T : value class static void NotDefault(T value, System::String ^ parameterName);
[System.Diagnostics.DebuggerStepThrough]
public static void NotDefault<T> (T value, string? parameterName = default) where T : struct;
[<System.Diagnostics.DebuggerStepThrough>]
static member NotDefault : 'T * string -> unit (requires 'T : struct)
Public Shared Sub NotDefault(Of T As Structure) (value As T, Optional parameterName As String = Nothing)
Type Parameters
- T
The type of the parameter.
Parameters
- value
- 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 value
is null
or empty.