Unosquare
    Show / Hide Table of Contents

    Class NameValueCollectionExtensions

    Provides extension methods for .

    Inheritance
    Object
    NameValueCollectionExtensions
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: EmbedIO.Utilities
    Syntax
    public static class NameValueCollectionExtensions

    Methods

    Contains(NameValueCollection, String, String)

    Determines whether a contains one or more values for the specified name, at least one of which is equal to the specified value. Value comparisons are carried out using the comparison type.

    Declaration
    public static bool Contains(this NameValueCollection this, string name, string value)
    Parameters
    Type Name Description
    NameValueCollection this

    The on which this method is called.

    String name

    The name to look for.

    String value

    The value to look for.

    Returns
    Type Description
    Boolean

    true if at least one of the values for name in the collection is equal to value; otherwise, false.

    Remarks

    White space is trimmed from the start and end of each value before comparison.

    See Also
    Contains(NameValueCollection, String, String, StringComparison)

    Contains(NameValueCollection, String, String, StringComparison)

    Determines whether a contains one or more values for the specified name, at least one of which is equal to the specified value. Value comparisons are carried out using the specified comparisonType.

    Declaration
    public static bool Contains(this NameValueCollection this, string name, string value, StringComparison comparisonType)
    Parameters
    Type Name Description
    NameValueCollection this

    The on which this method is called.

    String name

    The name to look for.

    String value

    The value to look for.

    StringComparison comparisonType

    One of the enumeration values that specifies how the strings will be compared.

    Returns
    Type Description
    Boolean

    true if at least one of the values for name in the collection is equal to value; otherwise, false.

    Remarks

    White space is trimmed from the start and end of each value before comparison.

    See Also
    Contains(NameValueCollection, String, String)

    ContainsKey(NameValueCollection, String)

    Determines whether a contains one or more values for the specified key.

    Declaration
    public static bool ContainsKey(this NameValueCollection this, string key)
    Parameters
    Type Name Description
    NameValueCollection this

    The on which this method is called.

    String key

    The key to look for.

    Returns
    Type Description
    Boolean

    true if at least one value for key is present in the collection; otherwise, false.

    ToArrayDictionary(NameValueCollection)

    Converts a to a dictionary of arrays of strings.

    Declaration
    public static Dictionary<string, string[]> ToArrayDictionary(this NameValueCollection this)
    Parameters
    Type Name Description
    NameValueCollection this

    The on which this method is called.

    Returns
    Type Description
    Dictionary<String, String[]>

    A associating the collection's keys with arrays of their values.

    ToDictionary(NameValueCollection)

    Converts a to a dictionary of objects.

    Values in the returned dictionary will wither be strings, or arrays of strings, depending on the presence of multiple values for the same key in the collection.

    Declaration
    public static Dictionary<string, object> ToDictionary(this NameValueCollection this)
    Parameters
    Type Name Description
    NameValueCollection this

    The on which this method is called.

    Returns
    Type Description
    Dictionary<String, Object>

    A associating the collection's keys with their values.

    ToStringDictionary(NameValueCollection)

    Converts a to a dictionary of strings.

    Declaration
    public static Dictionary<string, string> ToStringDictionary(this NameValueCollection this)
    Parameters
    Type Name Description
    NameValueCollection this

    The on which this method is called.

    Returns
    Type Description
    Dictionary<String, String>

    A associating the collection's keys with their values (or comma-separated lists in case of multiple values).

    Comments

    Back to top Copyright © 2017-2019 Unosquare