NameValueCollectionExtensions.GetInt32 method

Version 1.1.28
.NET Framework 4.8
Namespace Skybrud.Essentials.Collections.Extensions
Assembly Skybrud.Essentials.dll

GetInt32(NameValueCollection, string)

Extension method

Returns the int value of the item with the specified key, or 0 if a matching item couldn't be found or the value couldn't be parsed to an integer.

public static int GetInt32(this NameValueCollection collection, string key)

Parameters

collection NameValueCollection

The collection.

key String

The key of the item.

Returns

int

The value as an integer (int ).

GetInt32(NameValueCollection, string, int)

Extension method

Returns the int value of the item with the specified key, or 0 if a matching item couldn't be found or the value couldn't be parsed to an integer.

public static int GetInt32(this NameValueCollection collection, string key, int fallback)

Parameters

collection NameValueCollection

The collection.

key String

The key of the item.

fallback int

The fallback value that will be returned if the conversion fails.

Returns

int

The value as an integer (int ).