Exemplo n.º 1
0
    /// <summary>
    /// Deletes.
    /// </summary>
    /// <param name="a">Left element.</param>
    /// <param name="b">Right element.</param>
    /// <returns>The result.</returns>
    public static StringKeyValuePairs operator -(StringKeyValuePairs a, KeyValuePair <string, string> b)
    {
        if (a == null)
        {
            return(null);
        }
        var col = new StringKeyValuePairs();

        col.AddRange(a);
        a.Remove(b.Key, b.Value);
        return(col);
    }
Exemplo n.º 2
0
    /// <summary>
    /// Adds 2 elements.
    /// </summary>
    /// <param name="a">Left element.</param>
    /// <param name="b">Right element.</param>
    /// <returns>The result.</returns>
    public static StringKeyValuePairs operator +(StringKeyValuePairs a, KeyValuePair <string, string> b)
    {
        if (a == null)
        {
            return(null);
        }
        var col = new StringKeyValuePairs();

        if (a != null)
        {
            col.AddRange(a);
        }
        col.Add(b);
        return(col);
    }
Exemplo n.º 3
0
    /// <summary>
    /// Adds 2 elements.
    /// </summary>
    /// <param name="a">Left element.</param>
    /// <param name="b">Right element.</param>
    /// <returns>The result.</returns>
    public static StringKeyValuePairs operator +(StringKeyValuePairs a, IEnumerable <KeyValuePair <string, string> > b)
    {
        if (a == null && b == null)
        {
            return(null);
        }
        var col = new StringKeyValuePairs();

        if (a != null)
        {
            col.AddRange(a);
        }
        if (b != null)
        {
            col.AddRange(b);
        }
        return(col);
    }
Exemplo n.º 4
0
    /// <summary>
    /// Deletes.
    /// </summary>
    /// <param name="a">Left element.</param>
    /// <param name="b">Right element.</param>
    /// <returns>The result.</returns>
    public static StringKeyValuePairs operator -(StringKeyValuePairs a, IEnumerable <KeyValuePair <string, string> > b)
    {
        if (a == null)
        {
            return(null);
        }
        var col = new StringKeyValuePairs();

        col.AddRange(a);
        if (b == null)
        {
            return(col);
        }
        foreach (var kvp in b)
        {
            a.Remove(kvp.Key, kvp.Value);
        }

        return(col);
    }