Class DictionaryValueProvider<TValue>
Represents the base class for value providers whose values come from a collection that implements the IDictionary<TKey, TValue> interface.
public class DictionaryValueProvider<TValue> : IEnumerableValueProvider, IValueProvider
Type Parameters
TValue
The type of the value.
- Inheritance
-
DictionaryValueProvider<TValue>
- Implements
- Derived
- Inherited Members
Constructors
DictionaryValueProvider(IDictionary<string, TValue>, CultureInfo)
Initializes a new instance of the DictionaryValueProvider<TValue> class.
public DictionaryValueProvider(IDictionary<string, TValue> dictionary, CultureInfo culture)
Parameters
dictionary
IDictionary<string, TValue>The name/value pairs that are used to initialize the value provider.
culture
CultureInfoInformation about a specific culture, such as the names of the culture, the writing system, and the calendar used.
Exceptions
- ArgumentNullException
The
dictionary
parameter is null.
Methods
ContainsPrefix(string)
Determines whether the collection contains the specified prefix.
public virtual bool ContainsPrefix(string prefix)
Parameters
prefix
stringThe 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 from the prefix.
public virtual IDictionary<string, string> GetKeysFromPrefix(string prefix)
Parameters
prefix
stringthe prefix.
Returns
- IDictionary<string, string>
The keys from the prefix.
GetValue(string)
Returns a value object using the specified key and controller context.
public virtual ValueProviderResult GetValue(string key)
Parameters
key
stringThe key of the value object to retrieve.
Returns
- ValueProviderResult
The value object for the specified key.
Exceptions
- ArgumentNullException
The
key
parameter is null.