This content is part of a third party extension that is not supported by the Cake project.
For more information about this extension see Cake.Incubator.
Summary
Throws a
System.ArgumentNullException
if a string is null or white space, otherwise returns the value
- Assembly
- Cake
.Incubator .dll - Namespace
- Cake
.Incubator .AssertExtensions - Containing Type
- AssertExtensions
Syntax
public static string ThrowIfNullOrWhiteSpace(this string value, string varName)
Examples
replace the following
string myArg = "";
if (string.IsNullOrWhiteSpace(myArg))
{
throw new ArgumentNullException(nameof(myArg));
}
var arg1 = myArg;
with
string myArg = "";
var arg1 = myArg.ThrowIfNullOrWhiteSpace(nameof(myArg));
Attributes
Type | Description |
---|---|
Cake |
Parameters
Name | Type | Description |
---|---|---|
value | string | The object to check |
varName | string | The name of the variable |
Return Value
Type | Description |
---|---|
string | The non-null value |