NameValueCollectionExtensions.GetBoolean method
Version 1.1.28
.NET Framework 4.8
Namespace | Skybrud.Essentials.Collections.Extensions |
---|---|
Assembly | Skybrud.Essentials.dll |
GetBoolean(NameValueCollection, string)
Extension method
Returns the boolean value of the item with key
. If an matching isn't found, or conversion to a boolean representation failed, false
is returned instead.
public static bool GetBoolean(this NameValueCollection collection, string key)
Returns
The converted value of the item with key
if the conversion was successful; otherwise false
.
GetBoolean(NameValueCollection, string, bool)
Extension method
Returns the boolean value of the item with key
. If an matching isn't found, or conversion to a boolean representation failed, fallback
is returned instead.
public static bool GetBoolean(this NameValueCollection collection, string key, bool fallback)
Parameters
collection
NameValueCollection
The collection.
key
String
The key of the item.
fallback
bool
The fallback value that will be returned if the conversion fails.
Returns
The converted value of the item with key
if the conversion was successful; otherwise fallback
.