Table of Contents

Class ValueProviderDictionary

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

Note: This API is now obsolete.Represents a dictionary of value providers for the application.

[Obsolete("The recommended alternative is to use one of the specific ValueProvider types, such as FormValueProvider.")]
public class ValueProviderDictionary : IDictionary<string, ValueProviderResult>, ICollection<KeyValuePair<string, ValueProviderResult>>, IEnumerable<KeyValuePair<string, ValueProviderResult>>, IEnumerable, IValueProvider
Inheritance
ValueProviderDictionary
Implements
Inherited Members

Constructors

ValueProviderDictionary(ControllerContext)

Initializes a new instance of the ValueProviderDictionary class.

public ValueProviderDictionary(ControllerContext controllerContext)

Parameters

controllerContext ControllerContext

The controller context.

Properties

ControllerContext

Gets or sets the controller context.

public ControllerContext ControllerContext { get; }

Property Value

ControllerContext

The controller context.

Count

Gets the number of elements in the collection.

public int Count { get; }

Property Value

int

The number of elements in the collection.

IsReadOnly

Gets a value that indicates whether the collection is read-only.

public bool IsReadOnly { get; }

Property Value

bool

true if the collection is read-only; otherwise, false.

this[string]

Gets or sets the ValueProviderResult object that has the specified key.

public ValueProviderResult this[string key] { get; set; }

Parameters

key string

Property Value

ValueProviderResult

The ValueProviderResult object.

Keys

Gets a collection that contains the keys of the IDictionary<TKey, TValue> instance.

public ICollection<string> Keys { get; }

Property Value

ICollection<string>

A collection that contains the keys of the object that implements the IDictionary<TKey, TValue> interface.

Values

Gets a collection that contains the values in the IDictionary<TKey, TValue> object.

public ICollection<ValueProviderResult> Values { get; }

Property Value

ICollection<ValueProviderResult>

A collection of the values in the object that implements the IDictionary<TKey, TValue> interface.

Methods

Add(KeyValuePair<string, ValueProviderResult>)

Adds the specified item to the collection of value providers.

public void Add(KeyValuePair<string, ValueProviderResult> item)

Parameters

item KeyValuePair<string, ValueProviderResult>

The object to add to the ICollection<T> object.

Exceptions

NotSupportedException

The ICollection<T> object is read-only.

Add(string, object)

Adds an element that has the specified key and value to the collection of value providers.

public void Add(string key, object value)

Parameters

key string

The key of the element to add.

value object

The value of the element to add.

Exceptions

NotSupportedException

The IDictionary<TKey, TValue> object is read-only.

ArgumentNullException

key is null.

ArgumentException

An element that has the specified key already exists in the IDictionary<TKey, TValue> object.

Add(string, ValueProviderResult)

Adds an element that has the specified key and value to the collection of value providers.

public void Add(string key, ValueProviderResult value)

Parameters

key string

The key of the element to add.

value ValueProviderResult

The value of the element to add.

Exceptions

NotSupportedException

The IDictionary<TKey, TValue> object is read-only.

ArgumentNullException

key is null.

ArgumentException

An element that has the specified key already exists in the IDictionary<TKey, TValue> object.

Clear()

Removes all items from the collection of value providers.

public void Clear()

Exceptions

NotSupportedException

The ICollection<T> object is read-only.

Contains(KeyValuePair<string, ValueProviderResult>)

Determines whether the collection of value providers contains the specified item.

public bool Contains(KeyValuePair<string, ValueProviderResult> item)

Parameters

item KeyValuePair<string, ValueProviderResult>

The object to locate in the ICollection<T> instance.

Returns

bool

true if item is found in the collection of value providers; otherwise, false.

ContainsKey(string)

Determines whether the collection of value providers contains an element that has the specified key.

public bool ContainsKey(string key)

Parameters

key string

The key of the element to find in the IDictionary<TKey, TValue> instance.

Returns

bool

true if the collection of value providers contains an element that has the key; otherwise, false.

Exceptions

ArgumentNullException

key is null.

CopyTo(KeyValuePair<string, ValueProviderResult>[], int)

Copies the elements of the collection to an array, starting at the specified index.

public void CopyTo(KeyValuePair<string, ValueProviderResult>[] array, int arrayIndex)

Parameters

array KeyValuePair<string, ValueProviderResult>[]

The one-dimensional array that is the destination of the elements copied from the ICollection<T> object. The array must have zero-based indexing.

arrayIndex int

The zero-based index in array at which copying starts.

Exceptions

ArgumentNullException

array is null.

ArgumentOutOfRangeException

arrayIndex is less than 0.

ArgumentException

array is multidimensional.-or-arrayIndex is equal to or greater than the length of array.-or-The number of elements in the source collection is greater than the available space from arrayIndex to the end of the destination array.-or-Type T cannot be cast automatically to the type of the destination array.

GetEnumerator()

Returns an enumerator that can be used to iterate through the collection.

public IEnumerator<KeyValuePair<string, ValueProviderResult>> GetEnumerator()

Returns

IEnumerator<KeyValuePair<string, ValueProviderResult>>

An enumerator that can be used to iterate through the collection.

Remove(KeyValuePair<string, ValueProviderResult>)

Removes the first occurrence of the specified item from the collection of value providers.

public bool Remove(KeyValuePair<string, ValueProviderResult> item)

Parameters

item KeyValuePair<string, ValueProviderResult>

The object to remove from the ICollection<T> instance.

Returns

bool

true if item was successfully removed from the collection; otherwise, false. This method also returns false if item is not found in the collection.

Exceptions

NotSupportedException

The ICollection<T> object is read-only.

Remove(string)

Removes the element that has the specified key from the collection of value providers.

public bool Remove(string key)

Parameters

key string

The key of the element to remove.

Returns

bool

true if the element was successfully removed; otherwise, false. This method also returns false if key was not found in the collection.

Exceptions

NotSupportedException

The IDictionary<TKey, TValue> object is read-only.

ArgumentNullException

key is null.

TryGetValue(string, out ValueProviderResult)

Gets the value of the element that has the specified key.

public bool TryGetValue(string key, out ValueProviderResult value)

Parameters

key string

The key of the element to get.

value ValueProviderResult

When this method returns, the value that is associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized.

Returns

bool

true if the object that implements IDictionary<TKey, TValue> contains an element that has the specified key; otherwise, false.

Exceptions

ArgumentNullException

key is null.