Table of Contents

Class FormCollectionExtensions

Namespace
Umbraco.Extensions
Assembly
Umbraco.Web.Common.dll
public static class FormCollectionExtensions
Inheritance
FormCollectionExtensions
Inherited Members

Methods

GetRequiredString(FormCollection, string)

Returns the value of a mandatory item in the FormCollection

public static string? GetRequiredString(this FormCollection items, string key)

Parameters

items FormCollection
key string

Returns

string

GetRequiredValue<T>(FormCollection, string)

Returns the object based in the collection based on it's key. This does this with a conversion so if it doesn't convert or the query string is no there an exception is thrown

public static T GetRequiredValue<T>(this FormCollection items, string key)

Parameters

items FormCollection
key string

Returns

T

Type Parameters

T

GetValue<T>(FormCollection, string)

Returns the object based in the collection based on it's key. This does this with a conversion so if it doesn't convert a null object is returned.

public static T? GetValue<T>(this FormCollection items, string key)

Parameters

items FormCollection
key string

Returns

T

Type Parameters

T

HasKey(FormCollection, string)

Checks if the collection contains the key

public static bool HasKey(this FormCollection items, string key)

Parameters

items FormCollection
key string

Returns

bool

ToDictionary(FormCollection)

Converts the FormCollection to a dictionary

public static IDictionary<string, object> ToDictionary(this FormCollection items)

Parameters

items FormCollection

Returns

IDictionary<string, object>

ToQueryString(FormCollection?, params string[])

Converts a dictionary object to a query string representation such as: firstname=shannon&lastname=deminick

public static string ToQueryString(this FormCollection? items, params string[] keysToIgnore)

Parameters

items FormCollection
keysToIgnore string[]

Any keys found in this collection will be removed from the output

Returns

string