Class ValueProviderDictionary
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
controllerContextControllerContextThe 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
keystring
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
itemKeyValuePair<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
Exceptions
- NotSupportedException
The IDictionary<TKey, TValue> object is read-only.
- ArgumentNullException
keyis 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
keystringThe key of the element to add.
valueValueProviderResultThe value of the element to add.
Exceptions
- NotSupportedException
The IDictionary<TKey, TValue> object is read-only.
- ArgumentNullException
keyis 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
itemKeyValuePair<string, ValueProviderResult>The object to locate in the ICollection<T> instance.
Returns
- bool
true if
itemis 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
keystringThe 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
keyis 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
arrayKeyValuePair<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.
arrayIndexintThe zero-based index in
arrayat which copying starts.
Exceptions
- ArgumentNullException
arrayis null.- ArgumentOutOfRangeException
arrayIndexis less than 0.- ArgumentException
arrayis multidimensional.-or-arrayIndexis equal to or greater than the length ofarray.-or-The number of elements in the source collection is greater than the available space fromarrayIndexto the end of the destinationarray.-or-TypeTcannot 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
itemKeyValuePair<string, ValueProviderResult>The object to remove from the ICollection<T> instance.
Returns
- bool
true if
itemwas successfully removed from the collection; otherwise, false. This method also returns false ifitemis 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
keystringThe key of the element to remove.
Returns
- bool
true if the element was successfully removed; otherwise, false. This method also returns false if
keywas not found in the collection.
Exceptions
- NotSupportedException
The IDictionary<TKey, TValue> object is read-only.
- ArgumentNullException
keyis 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
keystringThe key of the element to get.
valueValueProviderResultWhen 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
valueparameter. 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
keyis null.