Class NameValuePairsValueProvider
- Namespace
- System.Web.Http.ValueProviders.Providers
- Assembly
- System.Web.Http.dll
A value provider for name/value pairs.
public class NameValuePairsValueProvider : IEnumerableValueProvider, IValueProvider
- Inheritance
-
NameValuePairsValueProvider
- Implements
- Derived
- Inherited Members
Constructors
NameValuePairsValueProvider(IEnumerable<KeyValuePair<string, string>>, CultureInfo)
Initializes a new instance of the NameValuePairsValueProvider class.
public NameValuePairsValueProvider(IEnumerable<KeyValuePair<string, string>> values, CultureInfo culture)
Parameters
values
IEnumerable<KeyValuePair<string, string>>The name/value pairs for the provider.
culture
CultureInfoThe culture used for the name/value pairs.
NameValuePairsValueProvider(Func<IEnumerable<KeyValuePair<string, string>>>, CultureInfo)
Initializes a new instance of the NameValuePairsValueProvider class, using a function delegate to provide the name/value pairs.
public NameValuePairsValueProvider(Func<IEnumerable<KeyValuePair<string, string>>> valuesFactory, CultureInfo culture)
Parameters
valuesFactory
Func<IEnumerable<KeyValuePair<string, string>>>A function delegate that returns a collection of name/value pairs.
culture
CultureInfoThe culture used for the name/value pairs.
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.
GetKeysFromPrefix(string)
Gets the keys from a prefix.
public virtual IDictionary<string, string> GetKeysFromPrefix(string prefix)
Parameters
prefix
stringThe prefix.
Returns
- IDictionary<string, string>
The keys.
GetValue(string)
Retrieves a value object using the specified key.
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.