BooleanExtensionsThrowIfFalseTException Method
Throws an exception if the source value is false.
Namespace: DevCase.Extensions.BooleanExtensionsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[EditorBrowsableAttribute(EditorBrowsableState.Always)]
public static void ThrowIfFalse<TException>(
this bool value,
TException ex = null
)
where TException : Exception
<ExtensionAttribute>
<EditorBrowsableAttribute(EditorBrowsableState.Always)>
Public Shared Sub ThrowIfFalse(Of TException As Exception) (
value As Boolean,
Optional ex As TException = Nothing
)
Dim value As Boolean
Dim ex As TException
value.ThrowIfFalse(ex)
public:
[ExtensionAttribute]
[EditorBrowsableAttribute(EditorBrowsableState::Always)]
generic<typename TException>
where TException : Exception
static void ThrowIfFalse(
bool value,
TException ex = nullptr
)
[<ExtensionAttribute>]
[<EditorBrowsableAttribute(EditorBrowsableState.Always)>]
static member ThrowIfFalse :
value : bool *
?ex : 'TException
(* Defaults:
let _ex = defaultArg ex null
*)
-> unit when 'TException : Exception
No code example is currently available or this language may not be supported.
- value Boolean
-
The value to evaluate.
- ex TException (Optional)
-
Optionally, a instance of the exception to throw if the source value is false.
If this value is null, a default instance of the exception type will be used.
- TException
-
The type of exception to throw.
In Visual Basic and C#, you can call this method as an instance method on any object of type
Boolean. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
This is a code example.
No code example is currently available or this language may not be supported.
Dim value As Boolean = False
' value.ThrowIfFalse(Of ArgumentException)
value.ThrowIfFalse(New ArgumentException(message:="'true' expected.", paramName:=NameOf(value)))
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.