Class CollectionExtensions
Provides a collection of useful extensions to collections.
Inheritance
Namespace: DotNetNuke.Collections
Assembly: DotNetNuke.dll
Syntax
public static class CollectionExtensions : object
Methods
| Improve this Doc View SourceCreateDictionaryFromString(String, Char, Char)
Converts a string with multiple key-value pairs into a Dictionary, if there are duplicated keys in your string only the first found key is kept since keys must be unique in a Dictionary.
Declaration
public static Dictionary<string, string> CreateDictionaryFromString(string stringOfPairs, char pairsSeparator, char pairSeparator)
Parameters
Type | Name | Description |
---|---|---|
System.String | stringOfPairs | The string containing the key-value pairs. |
System.Char | pairsSeparator | The separator used to separate each key-value pair. |
System.Char | pairSeparator | The separator used between the each key and value. |
Returns
Type | Description |
---|---|
Dictionary<System.String, System.String> | Dictionary with a string key and a string value. |
DictionaryToString(Dictionary<String, String>, String, String)
Converts a Dictionary with a string key and a string value into a plain string separated by your choice of separators.
Declaration
public static string DictionaryToString(this Dictionary<string, string> dictionary, string pairsSeparator, string pairSeparator)
Parameters
Type | Name | Description |
---|---|---|
Dictionary<System.String, System.String> | dictionary | The Dictionary to convert. |
System.String | pairsSeparator | The separator to use between key-value pairs. |
System.String | pairSeparator | The separator to use between each key and value. |
Returns
Type | Description |
---|---|
System.String | The dictionary's contents as a |
ForEach<TType>(IEnumerable<TType>, Action<TType>)
Executes an action for each element in the source collection.
Declaration
public static IEnumerable<TType> ForEach<TType>(this IEnumerable<TType> source, Action<TType> action)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TType> | source | The source. |
Action<TType> | action | The action. |
Returns
Type | Description |
---|---|
IEnumerable<TType> | The provided source after the action was performed on each element. |
Type Parameters
Name | Description |
---|---|
TType | The type of the type. |
GetFlexibleBooleanParsingFunction()
Gets a converter function which parses a true
if it is one of the following (case-insensitive):
- true
- on
- 1
- yes
Declaration
public static Func<string, bool> GetFlexibleBooleanParsingFunction()
Returns
Type | Description |
---|---|
Func<System.String, System.Boolean> | A |
GetFlexibleBooleanParsingFunction(String[])
Gets a converter function which parses a
Declaration
public static Func<string, bool> GetFlexibleBooleanParsingFunction(params string[] trueValues)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | trueValues | The |
Returns
Type | Description |
---|---|
Func<System.String, System.Boolean> | A |
GetValue<T>(IDictionary, String, Func<Object, T>)
Gets the value from the dictionary.
Declaration
public static T GetValue<T>(this IDictionary dictionary, string key, Func<object, T> converter)
Parameters
Type | Name | Description |
---|---|---|
IDictionary | dictionary | The dictionary. |
System.String | key | The key by which to get the value. |
Func<System.Object, T> | converter | A function to convert the value as an |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValue<T>(IDictionary, String, Func<String, T>)
Gets the value from the dictionary.
Declaration
public static T GetValue<T>(this IDictionary dictionary, string key, Func<string, T> converter)
Parameters
Type | Name | Description |
---|---|---|
IDictionary | dictionary | The dictionary. |
System.String | key | The key by which to get the value. |
Func<System.String, T> | converter | A function to convert the value as an |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValue<T>(IDictionary, String)
Gets the value from the dictionary.
Declaration
public static T GetValue<T>(this IDictionary dictionary, string key)
Parameters
Type | Name | Description |
---|---|---|
IDictionary | dictionary | The dictionary. |
System.String | key | The key by which to get the value. |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValue<T>(ILookup<String, String>, String, Func<Object, T>)
Gets the value from the lookup.
Declaration
public static T GetValue<T>(this ILookup<string, string> lookup, string key, Func<object, T> converter)
Parameters
Type | Name | Description |
---|---|---|
ILookup<System.String, System.String> | lookup | The lookup. |
System.String | key | The key by which to get the value. |
Func<System.Object, T> | converter | A function to convert the value as an |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValue<T>(ILookup<String, String>, String, Func<String, T>)
Gets the value from the lookup.
Declaration
public static T GetValue<T>(this ILookup<string, string> lookup, string key, Func<string, T> converter)
Parameters
Type | Name | Description |
---|---|---|
ILookup<System.String, System.String> | lookup | The lookup. |
System.String | key | The key by which to get the value. |
Func<System.String, T> | converter | A function to convert the value as an |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValue<T>(ILookup<String, String>, String)
Gets the value from the lookup.
Declaration
public static T GetValue<T>(this ILookup<string, string> lookup, string key)
Parameters
Type | Name | Description |
---|---|---|
ILookup<System.String, System.String> | lookup | The lookup. |
System.String | key | The key by which to get the value. |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValue<T>(IXPathNavigable, String, Func<Object, T>)
Gets the value from the XML node's child elements.
Declaration
public static T GetValue<T>(this IXPathNavigable node, string key, Func<object, T> converter)
Parameters
Type | Name | Description |
---|---|---|
IXPathNavigable | node | An XML node which containers other elements. |
System.String | key | The name of the element from which to get the value. |
Func<System.Object, T> | converter | A function to convert the value as an |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValue<T>(IXPathNavigable, String, Func<String, T>)
Gets the value from the XML node's child elements.
Declaration
public static T GetValue<T>(this IXPathNavigable node, string key, Func<string, T> converter)
Parameters
Type | Name | Description |
---|---|---|
IXPathNavigable | node | An XML node which containers other elements. |
System.String | key | The name of the element from which to get the value. |
Func<System.String, T> | converter | A function to convert the value as an |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValue<T>(IXPathNavigable, String)
Gets the value from the XML node's child elements, returning the default value of if the value doesn't exist.
Declaration
public static T GetValue<T>(this IXPathNavigable node, string key)
Parameters
Type | Name | Description |
---|---|---|
IXPathNavigable | node | An XML node which containers other elements. |
System.String | key | The name of the element from which to get the value. |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValue<T>(NameValueCollection, String, Func<Object, T>)
Gets the value from the collection.
Declaration
public static T GetValue<T>(this NameValueCollection collection, string key, Func<object, T> converter)
Parameters
Type | Name | Description |
---|---|---|
NameValueCollection | collection | The collection. |
System.String | key | The key by which to get the value. |
Func<System.Object, T> | converter | A function to convert the value as an |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValue<T>(NameValueCollection, String, Func<String, T>)
Gets the value from the collection.
Declaration
public static T GetValue<T>(this NameValueCollection collection, string key, Func<string, T> converter)
Parameters
Type | Name | Description |
---|---|---|
NameValueCollection | collection | The collection. |
System.String | key | The key by which to get the value. |
Func<System.String, T> | converter | A function to convert the value as an |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValue<T>(NameValueCollection, String)
Gets the value from the collection.
Declaration
public static T GetValue<T>(this NameValueCollection collection, string key)
Parameters
Type | Name | Description |
---|---|---|
NameValueCollection | collection | The collection. |
System.String | key | The key by which to get the value. |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValue<T>(XContainer, String, Func<Object, T>)
Gets the value from the XML node's child elements.
Declaration
public static T GetValue<T>(this XContainer node, string key, Func<object, T> converter)
Parameters
Type | Name | Description |
---|---|---|
XContainer | node | An XML node which containers other elements. |
System.String | key | The name of the element from which to get the value. |
Func<System.Object, T> | converter | A function to convert the value as an |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValue<T>(XContainer, String, Func<String, T>)
Gets the value from the XML node's child elements.
Declaration
public static T GetValue<T>(this XContainer node, string key, Func<string, T> converter)
Parameters
Type | Name | Description |
---|---|---|
XContainer | node | An XML node which containers other elements. |
System.String | key | The name of the element from which to get the value. |
Func<System.String, T> | converter | A function to convert the value as an |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValue<T>(XContainer, String)
Gets the value from the XML node's child elements.
Declaration
public static T GetValue<T>(this XContainer node, string key)
Parameters
Type | Name | Description |
---|---|---|
XContainer | node | An XML node which containers other elements. |
System.String | key | The name of the element from which to get the value. |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValueOrDefault<T>(IDictionary, String, T, Func<Object, T>)
Gets the value from the dictionary, returning the if the value doesn't exist.
Declaration
public static T GetValueOrDefault<T>(this IDictionary dictionary, string key, T defaultValue, Func<object, T> converter)
Parameters
Type | Name | Description |
---|---|---|
IDictionary | dictionary | The dictionary. |
System.String | key | The key by which to get the value. |
T | defaultValue | The default value to return if the dictionary doesn't have a value for the given |
Func<System.Object, T> | converter | A function to convert the value as an |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValueOrDefault<T>(IDictionary, String, T, Func<String, T>)
Gets the value from the dictionary, returning defaultValue
if the value doesn't exist.
Declaration
public static T GetValueOrDefault<T>(this IDictionary dictionary, string key, T defaultValue, Func<string, T> converter)
Parameters
Type | Name | Description |
---|---|---|
IDictionary | dictionary | The dictionary. |
System.String | key | The key by which to get the value. |
T | defaultValue | The default value to return if the dictionary doesn't have a value for the given |
Func<System.String, T> | converter | A function to convert the value as an |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValueOrDefault<T>(IDictionary, String, T)
Gets the value from the dictionary, returning defaultValue
if the value doesn't exist.
Declaration
public static T GetValueOrDefault<T>(this IDictionary dictionary, string key, T defaultValue)
Parameters
Type | Name | Description |
---|---|---|
IDictionary | dictionary | The dictionary. |
System.String | key | The key by which to get the value. |
T | defaultValue | The default value to return if the dictionary doesn't have a value for the given |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValueOrDefault<T>(IDictionary, String, Func<Object, T>)
Gets the value from the dictionary, returning the default value of if the value doesn't exist.
Declaration
public static T GetValueOrDefault<T>(this IDictionary dictionary, string key, Func<object, T> converter)
Parameters
Type | Name | Description |
---|---|---|
IDictionary | dictionary | The dictionary. |
System.String | key | The key by which to get the value. |
Func<System.Object, T> | converter | A function to convert the value as an |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValueOrDefault<T>(IDictionary, String, Func<String, T>)
Gets the value from the dictionary, returning the default value of if the value doesn't exist.
Declaration
public static T GetValueOrDefault<T>(this IDictionary dictionary, string key, Func<string, T> converter)
Parameters
Type | Name | Description |
---|---|---|
IDictionary | dictionary | The dictionary. |
System.String | key | The key by which to get the value. |
Func<System.String, T> | converter | A function to convert the value as an |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValueOrDefault<T>(IDictionary, String)
Gets the value from the dictionary, returning the default value of if the value doesn't exist.
Declaration
public static T GetValueOrDefault<T>(this IDictionary dictionary, string key)
Parameters
Type | Name | Description |
---|---|---|
IDictionary | dictionary | The dictionary. |
System.String | key | The key by which to get the value. |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValueOrDefault<T>(ILookup<String, String>, String, T, Func<Object, T>)
Gets the value from the lookup, returning defaultValue
if the value doesn't exist.
Declaration
public static T GetValueOrDefault<T>(this ILookup<string, string> lookup, string key, T defaultValue, Func<object, T> converter)
Parameters
Type | Name | Description |
---|---|---|
ILookup<System.String, System.String> | lookup | The lookup. |
System.String | key | The key by which to get the value. |
T | defaultValue | The default value to return if the lookup doesn't have a value for the given |
Func<System.Object, T> | converter | A function to convert the value as an |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValueOrDefault<T>(ILookup<String, String>, String, T, Func<String, T>)
Gets the value from the lookup, returning defaultValue
if the value doesn't exist.
Declaration
public static T GetValueOrDefault<T>(this ILookup<string, string> lookup, string key, T defaultValue, Func<string, T> converter)
Parameters
Type | Name | Description |
---|---|---|
ILookup<System.String, System.String> | lookup | The lookup. |
System.String | key | The key by which to get the value. |
T | defaultValue | The default value to return if the lookup doesn't have a value for the given |
Func<System.String, T> | converter | A function to convert the value as an |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValueOrDefault<T>(ILookup<String, String>, String, T)
Gets the value from the lookup, returning defaultValue
if the value doesn't exist.
Declaration
public static T GetValueOrDefault<T>(this ILookup<string, string> lookup, string key, T defaultValue)
Parameters
Type | Name | Description |
---|---|---|
ILookup<System.String, System.String> | lookup | The lookup. |
System.String | key | The key by which to get the value. |
T | defaultValue | The default value to return if the lookup doesn't have a value for the given |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValueOrDefault<T>(ILookup<String, String>, String, Func<Object, T>)
Gets the value from the lookup, returning the default value of if the value doesn't exist.
Declaration
public static T GetValueOrDefault<T>(this ILookup<string, string> lookup, string key, Func<object, T> converter)
Parameters
Type | Name | Description |
---|---|---|
ILookup<System.String, System.String> | lookup | The lookup. |
System.String | key | The key by which to get the value. |
Func<System.Object, T> | converter | A function to convert the value as an |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValueOrDefault<T>(ILookup<String, String>, String, Func<String, T>)
Gets the value from the lookup, returning the default value of if the value doesn't exist.
Declaration
public static T GetValueOrDefault<T>(this ILookup<string, string> lookup, string key, Func<string, T> converter)
Parameters
Type | Name | Description |
---|---|---|
ILookup<System.String, System.String> | lookup | The lookup. |
System.String | key | The key by which to get the value. |
Func<System.String, T> | converter | A function to convert the value as an |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValueOrDefault<T>(ILookup<String, String>, String)
Gets the value from the lookup, returning the default value of if the value doesn't exist.
Declaration
public static T GetValueOrDefault<T>(this ILookup<string, string> lookup, string key)
Parameters
Type | Name | Description |
---|---|---|
ILookup<System.String, System.String> | lookup | The lookup. |
System.String | key | The key by which to get the value. |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValueOrDefault<T>(IXPathNavigable, String, T, Func<Object, T>)
Gets the value from the XML node's child elements, returning defaultValue
if the value doesn't exist.
Declaration
public static T GetValueOrDefault<T>(this IXPathNavigable node, string key, T defaultValue, Func<object, T> converter)
Parameters
Type | Name | Description |
---|---|---|
IXPathNavigable | node | An XML node which containers other elements. |
System.String | key | The name of the element from which to get the value. |
T | defaultValue | The default value to return if the node doesn't have a value for the given |
Func<System.Object, T> | converter | A function to convert the value as an |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValueOrDefault<T>(IXPathNavigable, String, T, Func<String, T>)
Gets the value from the XML node's child elements, returning defaultValue
if the value doesn't exist.
Declaration
public static T GetValueOrDefault<T>(this IXPathNavigable node, string key, T defaultValue, Func<string, T> converter)
Parameters
Type | Name | Description |
---|---|---|
IXPathNavigable | node | An XML node which containers other elements. |
System.String | key | The name of the element from which to get the value. |
T | defaultValue | The default value to return if the node doesn't have a value for the given |
Func<System.String, T> | converter | A function to convert the value as a |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValueOrDefault<T>(IXPathNavigable, String, T)
Gets the value from the XML node's child elements, returning defaultValue
if the value doesn't exist.
Declaration
public static T GetValueOrDefault<T>(this IXPathNavigable node, string key, T defaultValue)
Parameters
Type | Name | Description |
---|---|---|
IXPathNavigable | node | An XML node which containers other elements. |
System.String | key | The name of the element from which to get the value. |
T | defaultValue | The default value to return if the node doesn't have a value for the given |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValueOrDefault<T>(IXPathNavigable, String, Func<Object, T>)
Gets the value from the XML node's child elements, returning the default value of if the value doesn't exist.
Declaration
public static T GetValueOrDefault<T>(this IXPathNavigable node, string key, Func<object, T> converter)
Parameters
Type | Name | Description |
---|---|---|
IXPathNavigable | node | An XML node which containers other elements. |
System.String | key | The name of the element from which to get the value. |
Func<System.Object, T> | converter | A function to convert the value as an |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValueOrDefault<T>(IXPathNavigable, String, Func<String, T>)
Gets the value from the XML node's child elements, returning the default value of if the value doesn't exist.
Declaration
public static T GetValueOrDefault<T>(this IXPathNavigable node, string key, Func<string, T> converter)
Parameters
Type | Name | Description |
---|---|---|
IXPathNavigable | node | An XML node which containers other elements. |
System.String | key | The name of the element from which to get the value. |
Func<System.String, T> | converter | A function to convert the value as an |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValueOrDefault<T>(IXPathNavigable, String)
Gets the value from the XML node's child elements, returning the default value of if the value doesn't exist.
Declaration
public static T GetValueOrDefault<T>(this IXPathNavigable node, string key)
Parameters
Type | Name | Description |
---|---|---|
IXPathNavigable | node | An XML node which containers other elements. |
System.String | key | The name of the element from which to get the value. |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValueOrDefault<T>(NameValueCollection, String, T, Func<Object, T>)
Gets the value from the collection, returning defaultValue
if the value doesn't exist.
Declaration
public static T GetValueOrDefault<T>(this NameValueCollection collection, string key, T defaultValue, Func<object, T> converter)
Parameters
Type | Name | Description |
---|---|---|
NameValueCollection | collection | The collection. |
System.String | key | The key by which to get the value. |
T | defaultValue | The default value to return if the collection doesn't have a value for the given |
Func<System.Object, T> | converter | A function to convert the value as an |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValueOrDefault<T>(NameValueCollection, String, T, Func<String, T>)
Gets the value from the collection, returning defaultValue
if the value doesn't exist.
Declaration
public static T GetValueOrDefault<T>(this NameValueCollection collection, string key, T defaultValue, Func<string, T> converter)
Parameters
Type | Name | Description |
---|---|---|
NameValueCollection | collection | The collection. |
System.String | key | The key by which to get the value. |
T | defaultValue | The default value to return if the collection doesn't have a value for the given |
Func<System.String, T> | converter | A function to convert the value as an |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValueOrDefault<T>(NameValueCollection, String, T)
Gets the value from the collection, returning defaultValue
if the value doesn't exist.
Declaration
public static T GetValueOrDefault<T>(this NameValueCollection collection, string key, T defaultValue)
Parameters
Type | Name | Description |
---|---|---|
NameValueCollection | collection | The collection. |
System.String | key | The key by which to get the value. |
T | defaultValue | The default value to return if the collection doesn't have a value for the given |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValueOrDefault<T>(NameValueCollection, String, Func<Object, T>)
Gets the value from the collection, returning the default value of if the value doesn't exist.
Declaration
public static T GetValueOrDefault<T>(this NameValueCollection collection, string key, Func<object, T> converter)
Parameters
Type | Name | Description |
---|---|---|
NameValueCollection | collection | The collection. |
System.String | key | The key by which to get the value. |
Func<System.Object, T> | converter | A function to convert the value as an |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValueOrDefault<T>(NameValueCollection, String, Func<String, T>)
Gets the value from the collection, returning the default value of if the value doesn't exist.
Declaration
public static T GetValueOrDefault<T>(this NameValueCollection collection, string key, Func<string, T> converter)
Parameters
Type | Name | Description |
---|---|---|
NameValueCollection | collection | The collection. |
System.String | key | The key by which to get the value. |
Func<System.String, T> | converter | A function to convert the value as an |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValueOrDefault<T>(NameValueCollection, String)
Gets the value from the collection, returning the default value of if the value doesn't exist.
Declaration
public static T GetValueOrDefault<T>(this NameValueCollection collection, string key)
Parameters
Type | Name | Description |
---|---|---|
NameValueCollection | collection | The collection. |
System.String | key | The key by which to get the value. |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValueOrDefault<T>(XContainer, String, T, Func<Object, T>)
Gets the value from the XML node's child elements, returning defaultValue
if the value doesn't exist.
Declaration
public static T GetValueOrDefault<T>(this XContainer node, string key, T defaultValue, Func<object, T> converter)
Parameters
Type | Name | Description |
---|---|---|
XContainer | node | An XML node which containers other elements. |
System.String | key | The name of the element from which to get the value. |
T | defaultValue | The default value to return if the node doesn't have a value for the given |
Func<System.Object, T> | converter | A function to convert the value as an |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValueOrDefault<T>(XContainer, String, T, Func<String, T>)
Gets the value from the XML node's child elements, returning defaultValue
if the value doesn't exist.
Declaration
public static T GetValueOrDefault<T>(this XContainer node, string key, T defaultValue, Func<string, T> converter)
Parameters
Type | Name | Description |
---|---|---|
XContainer | node | An XML node which containers other elements. |
System.String | key | The name of the element from which to get the value. |
T | defaultValue | The default value to return if the node doesn't have a value for the given |
Func<System.String, T> | converter | A function to convert the value as a |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValueOrDefault<T>(XContainer, String, T)
Gets the value from the XML node's child elements, returning defaultValue
if the value doesn't exist.
Declaration
public static T GetValueOrDefault<T>(this XContainer node, string key, T defaultValue)
Parameters
Type | Name | Description |
---|---|---|
XContainer | node | An XML node which containers other elements. |
System.String | key | The name of the element from which to get the value. |
T | defaultValue | The default value to return if the node doesn't have a value for the given |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValueOrDefault<T>(XContainer, String, Func<Object, T>)
Gets the value from the XML node's child elements, returning the default value of if the value doesn't exist.
Declaration
public static T GetValueOrDefault<T>(this XContainer node, string key, Func<object, T> converter)
Parameters
Type | Name | Description |
---|---|---|
XContainer | node | An XML node which containers other elements. |
System.String | key | The name of the element from which to get the value. |
Func<System.Object, T> | converter | A function to convert the value as an |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValueOrDefault<T>(XContainer, String, Func<String, T>)
Gets the value from the XML node's child elements, returning the default value of if the value doesn't exist.
Declaration
public static T GetValueOrDefault<T>(this XContainer node, string key, Func<string, T> converter)
Parameters
Type | Name | Description |
---|---|---|
XContainer | node | An XML node which containers other elements. |
System.String | key | The name of the element from which to get the value. |
Func<System.String, T> | converter | A function to convert the value as an |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValueOrDefault<T>(XContainer, String)
Gets the value from the XML node's child elements, returning the default value of if the value doesn't exist.
Declaration
public static T GetValueOrDefault<T>(this XContainer node, string key)
Parameters
Type | Name | Description |
---|---|---|
XContainer | node | An XML node which containers other elements. |
System.String | key | The name of the element from which to get the value. |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The type of the value to retrieve. |
GetValues<T>(ILookup<String, String>, String, Func<String, T>)
Gets the values from the lookup.
Declaration
public static IEnumerable<T> GetValues<T>(this ILookup<string, string> lookup, string key, Func<string, T> converter)
Parameters
Type | Name | Description |
---|---|---|
ILookup<System.String, System.String> | lookup | The lookup. |
System.String | key | The key by which to get the values. |
Func<System.String, T> | converter | A function to convert a value as an |
Returns
Type | Description |
---|---|
IEnumerable<T> | A sequence of |
Type Parameters
Name | Description |
---|---|
T | The type of the values to retrieve. |
GetValues<T>(ILookup<String, String>, String)
Gets the values from the lookup.
Declaration
public static IEnumerable<T> GetValues<T>(this ILookup<string, string> lookup, string key)
Parameters
Type | Name | Description |
---|---|---|
ILookup<System.String, System.String> | lookup | The lookup. |
System.String | key | The key by which to get the values. |
Returns
Type | Description |
---|---|
IEnumerable<T> | A sequence of |
Type Parameters
Name | Description |
---|---|
T | The type of the values to retrieve. |
GetValues<T>(NameValueCollection, String, Func<String, T>)
Gets the values from the collection.
Declaration
public static IEnumerable<T> GetValues<T>(this NameValueCollection collection, string key, Func<string, T> converter)
Parameters
Type | Name | Description |
---|---|---|
NameValueCollection | collection | The collection. |
System.String | key | The key by which to get the values. |
Func<System.String, T> | converter | A function to convert a value as an |
Returns
Type | Description |
---|---|
IEnumerable<T> | A sequence of |
Type Parameters
Name | Description |
---|---|
T | The type of the values to retrieve. |
GetValues<T>(NameValueCollection, String)
Gets the values from the collection.
Declaration
public static IEnumerable<T> GetValues<T>(this NameValueCollection collection, string key)
Parameters
Type | Name | Description |
---|---|---|
NameValueCollection | collection | The collection. |
System.String | key | The key by which to get the values. |
Returns
Type | Description |
---|---|
IEnumerable<T> | A sequence of |
Type Parameters
Name | Description |
---|---|
T | The type of the values to retrieve. |
ToLookup(NameValueCollection, Boolean)
Converts the collection
to an
Declaration
public static ILookup<string, string> ToLookup(this NameValueCollection collection, bool splitValues)
Parameters
Type | Name | Description |
---|---|---|
NameValueCollection | collection | The collection. |
System.Boolean | splitValues | If |
Returns
Type | Description |
---|---|
ILookup<System.String, System.String> | An |
ToLookup(NameValueCollection)
Converts the collection
to an
Declaration
public static ILookup<string, string> ToLookup(this NameValueCollection collection)
Parameters
Type | Name | Description |
---|---|---|
NameValueCollection | collection | The collection. |
Returns
Type | Description |
---|---|
ILookup<System.String, System.String> | An |