Class ParameterCollection
A collection of parameters (key value pairs). May contain duplicate keys.
Inheritance
ParameterCollection
Assembly: Google.Apis.Core.dll
Syntax
public class ParameterCollection : List<KeyValuePair<string, string>>, IList<KeyValuePair<string, string>>, ICollection<KeyValuePair<string, string>>, IReadOnlyList<KeyValuePair<string, string>>, IReadOnlyCollection<KeyValuePair<string, string>>, IEnumerable<KeyValuePair<string, string>>, IList, ICollection, IEnumerable
Constructors
ParameterCollection()
Constructs a new parameter collection.
Declaration
public ParameterCollection()
ParameterCollection(IEnumerable<KeyValuePair<string, string>>)
Constructs a new parameter collection from the given collection.
Declaration
public ParameterCollection(IEnumerable<KeyValuePair<string, string>> collection)
Parameters
Properties
this[string]
Returns all matches for the specified key. May return an empty enumeration if the key is not present.
Declaration
public IEnumerable<string> this[string key] { get; }
Parameters
| Type |
Name |
Description |
| string |
key |
|
Property Value
Methods
Add(string, string)
Adds a single parameter to this collection.
Declaration
public void Add(string key, string value)
Parameters
ContainsKey(string)
Returns true if this parameter is set within the collection.
Declaration
public bool ContainsKey(string key)
Parameters
| Type |
Name |
Description |
| string |
key |
|
Returns
FromDictionary(IDictionary<string, object>)
Creates a parameter collection from the specified dictionary.
If the value is an enumerable, a parameter pair will be added for each value.
Otherwise the value will be converted into a string using the .ToString() method.
Declaration
public static ParameterCollection FromDictionary(IDictionary<string, object> dictionary)
Parameters
Returns
FromQueryString(string)
Creates a parameter collection from the specified URL encoded query string.
Example:
The query string "foo=bar&chocolate=cookie" would result in two parameters (foo and bar)
with the values "bar" and "cookie" set.
Declaration
public static ParameterCollection FromQueryString(string qs)
Parameters
| Type |
Name |
Description |
| string |
qs |
|
Returns
GetAllMatches(string)
Returns all matches for the specified key. May return an empty enumeration if the key is not present.
Declaration
public IEnumerable<string> GetAllMatches(string key)
Parameters
| Type |
Name |
Description |
| string |
key |
|
Returns
GetFirstMatch(string)
Returns the value of the first matching key, or throws a KeyNotFoundException if the parameter is not
present within the collection.
Declaration
public string GetFirstMatch(string key)
Parameters
| Type |
Name |
Description |
| string |
key |
|
Returns
TryGetValue(string, out string)
Tries to find the a key within the specified key value collection. Returns true if the key was found.
If a pair was found the out parameter value will contain the value of that pair.
Declaration
public bool TryGetValue(string key, out string value)
Parameters
Returns
Implements
Extension Methods