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, IEnumerableA collection of parameters (key value pairs). May contain duplicate keys.
Implements
IList<KeyValuePair<String, String>>, ICollection<KeyValuePair<String, String>>, IReadOnlyList<KeyValuePair<String, String>>, IReadOnlyCollection<KeyValuePair<String, String>>, IEnumerable<KeyValuePair<String, String>>, IList, ICollection, IEnumerableNamespace
Google.Apis.Requests.ParametersAssembly
Google.Apis.Core.dll
Constructors
ParameterCollection()
public ParameterCollection()Constructs a new parameter collection.
ParameterCollection(IEnumerable<KeyValuePair<String, String>>)
public ParameterCollection(IEnumerable<KeyValuePair<string, string>> collection)Constructs a new parameter collection from the given collection.
| Parameter | |
|---|---|
| Name | Description |
collection |
IEnumerable<KeyValuePair<String, String>> |
Properties
Item[String]
public IEnumerable<string> this[string key] { get; }Returns all matches for the specified key. May return an empty enumeration if the key is not present.
| Parameter | |
|---|---|
| Name | Description |
key |
String |
| Property Value | |
|---|---|
| Type | Description |
IEnumerable<String> |
|
Methods
Add(String, String)
public void Add(string key, string value)Adds a single parameter to this collection.
| Parameters | |
|---|---|
| Name | Description |
key |
String |
value |
String |
ContainsKey(String)
public bool ContainsKey(string key)Returns true if this parameter is set within the collection.
| Parameter | |
|---|---|
| Name | Description |
key |
String |
| Returns | |
|---|---|
| Type | Description |
Boolean |
|
FromDictionary(IDictionary<String, Object>)
public static ParameterCollection FromDictionary(IDictionary<string, object> dictionary)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.
| Parameter | |
|---|---|
| Name | Description |
dictionary |
IDictionary<String, Object> |
| Returns | |
|---|---|
| Type | Description |
ParameterCollection |
|
FromQueryString(String)
public static ParameterCollection FromQueryString(string qs)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.
| Parameter | |
|---|---|
| Name | Description |
qs |
String |
| Returns | |
|---|---|
| Type | Description |
ParameterCollection |
|
GetAllMatches(String)
public IEnumerable<string> GetAllMatches(string key)Returns all matches for the specified key. May return an empty enumeration if the key is not present.
| Parameter | |
|---|---|
| Name | Description |
key |
String |
| Returns | |
|---|---|
| Type | Description |
IEnumerable<String> |
|
GetFirstMatch(String)
public string GetFirstMatch(string key)Returns the value of the first matching key, or throws a KeyNotFoundException if the parameter is not present within the collection.
| Parameter | |
|---|---|
| Name | Description |
key |
String |
| Returns | |
|---|---|
| Type | Description |
String |
|
TryGetValue(String, out String)
public bool TryGetValue(string key, out string value)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.
| Parameters | |
|---|---|
| Name | Description |
key |
String |
value |
String |
| Returns | |
|---|---|
| Type | Description |
Boolean |
|