Table of Contents

Class NameValueCollectionValueProvider

Namespace
System.Web.Mvc
Assembly
System.Web.Mvc.dll

Represents the base class for value providers whose values come from a NameValueCollection object.

public class NameValueCollectionValueProvider : IUnvalidatedValueProvider, IEnumerableValueProvider, IValueProvider
Inheritance
NameValueCollectionValueProvider
Implements
Derived
Inherited Members

Constructors

NameValueCollectionValueProvider(NameValueCollection, NameValueCollection, CultureInfo)

Initializes a new instance of the NameValueCollectionValueProvider class using the specified unvalidated collection.

public NameValueCollectionValueProvider(NameValueCollection collection, NameValueCollection unvalidatedCollection, CultureInfo culture)

Parameters

collection NameValueCollection

A collection that contains the values that are used to initialize the provider.

unvalidatedCollection NameValueCollection

A collection that contains the values that are used to initialize the provider. This collection will not be validated.

culture CultureInfo

An object that contains information about the target culture.

NameValueCollectionValueProvider(NameValueCollection, NameValueCollection, CultureInfo, bool)

Initializes Name Value collection provider.

public NameValueCollectionValueProvider(NameValueCollection collection, NameValueCollection unvalidatedCollection, CultureInfo culture, bool jQueryToMvcRequestNormalizationRequired)

Parameters

collection NameValueCollection

Key value collection from request.

unvalidatedCollection NameValueCollection

Unvalidated key value collection from the request.

culture CultureInfo

Culture with which the values are to be used.

jQueryToMvcRequestNormalizationRequired bool

jQuery POST when sending complex Javascript objects to server does not encode in the way understandable by MVC. This flag should be set if the request should be normalized to MVC form - https://aspnetwebstack.codeplex.com/workitem/1564.

NameValueCollectionValueProvider(NameValueCollection, CultureInfo)

Initializes a new instance of the NameValueCollectionValueProvider class.

public NameValueCollectionValueProvider(NameValueCollection collection, CultureInfo culture)

Parameters

collection NameValueCollection

A collection that contains the values that are used to initialize the provider.

culture CultureInfo

An object that contains information about the target culture.

Exceptions

ArgumentNullException

The collection parameter is null.

Methods

ContainsPrefix(string)

Determines whether the collection contains the specified prefix.

public virtual bool ContainsPrefix(string prefix)

Parameters

prefix string

The prefix to search for.

Returns

bool

true if the collection contains the specified prefix; otherwise, false.

Exceptions

ArgumentNullException

The prefix parameter is null.

GetKeysFromPrefix(string)

Gets the keys using the specified prefix.

public virtual IDictionary<string, string> GetKeysFromPrefix(string prefix)

Parameters

prefix string

The prefix.

Returns

IDictionary<string, string>

They keys.

GetValue(string)

Returns a value object using the specified key.

public virtual ValueProviderResult GetValue(string key)

Parameters

key string

The key of the value object to retrieve.

Returns

ValueProviderResult

The value object for the specified key.

Exceptions

ArgumentNullException

The key parameter is null.

GetValue(string, bool)

Returns a value object using the specified key and validation directive.

public virtual ValueProviderResult GetValue(string key, bool skipValidation)

Parameters

key string

The key.

skipValidation bool

true if validation should be skipped; otherwise, false.

Returns

ValueProviderResult

The value object for the specified key.