亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? multidictionarybase.cs

?? C#寫的類似于STL的集合類,首先是C#編寫,可以用于.net變程.
?? CS
?? 第 1 頁 / 共 3 頁
字號(hào):
?//******************************
// Written by Peter Golde
// Copyright (c) 2004-2005, Wintellect
//
// Use and restribution of this code is subject to the license agreement 
// contained in the file "License.txt" accompanying this file.
//******************************

using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;

namespace Wintellect.PowerCollections
{
    /// <summary>
    /// MultiDictionaryBase is a base class that can be used to more easily implement a class
    /// that associates multiple values to a single key. The class implements the generic
    /// IDictionary&lt;TKey, ICollection&lt;TValue&gt;&gt; interface.
    /// </summary>
    /// <remarks>
    /// <para>To use MultiDictionaryBase as a base class, the derived class must override
    /// Count, Clear, Add, Remove(TKey), Remove(TKey,TValue), Contains(TKey,TValue), 
    /// EnumerateKeys, and TryEnumerateValuesForKey. </para>
    /// <para>It may wish consider overriding CountValues, CountAllValues, ContainsKey,
    /// and EqualValues, but these are not required.
    /// </para>
    /// </remarks>
    /// <typeparam name="TKey">The key type of the dictionary.</typeparam>
    /// <typeparam name="TValue">The value type of the dictionary.</typeparam>
    [Serializable]
    [DebuggerDisplay("{DebuggerDisplayString()}")]
    public abstract class MultiDictionaryBase<TKey, TValue> : CollectionBase<KeyValuePair<TKey, ICollection<TValue>>>,
                                                                                               IDictionary<TKey, ICollection<TValue>>
    {
        /// <summary>
        /// Creates a new MultiDictionaryBase. 
        /// </summary>
        protected MultiDictionaryBase()
        {
        }

        /// <summary>
        /// Clears the dictionary. This method must be overridden in the derived class.
        /// </summary>
        public abstract override void Clear();

        /// <summary>
        /// Gets the number of keys in the dictionary. This property must be overridden
        /// in the derived class.
        /// </summary>
        public abstract override int Count
        {
            get;
        }

        /// <summary>
        /// Enumerate all the keys in the dictionary. This method must be overridden by a derived
        /// class.
        /// </summary>
        /// <returns>An IEnumerator&lt;TKey&gt; that enumerates all of the keys in the collection that
        /// have at least one value associated with them.</returns>
        protected abstract IEnumerator<TKey> EnumerateKeys();

        /// <summary>
        /// Enumerate all of the values associated with a given key. This method must be overridden
        /// by the derived class. If the key exists and has values associated with it, an enumerator for those
        /// values is returned throught <paramref name="values"/>. If the key does not exist, false is returned.
        /// </summary>
        /// <param name="key">The key to get values for.</param>
        /// <param name="values">If true is returned, this parameter receives an enumerators that
        /// enumerates the values associated with that key.</param>
        /// <returns>True if the key exists and has values associated with it. False otherwise.</returns>
        protected abstract bool TryEnumerateValuesForKey(TKey key, out IEnumerator<TValue> values);

        /// <summary>
        /// Adds a key-value pair to the collection. The value part of the pair must be a collection
        /// of values to associate with the key. If values are already associated with the given
        /// key, the new values are added to the ones associated with that key.
        /// </summary>
        /// <param name="item">A KeyValuePair contains the Key and Value collection to add.</param>
        public override void Add(KeyValuePair<TKey, ICollection<TValue>> item)
        {
            this.AddMany(item.Key, item.Value);
        }

        /// <summary>
        /// Implements IDictionary&lt;TKey, IEnumerable&lt;TValue&gt;&gt;.Add. If the 
        /// key is already present, and ArgumentException is thrown. Otherwise, a
        /// new key is added, and new values are associated with that key.
        /// </summary>
        /// <param name="key">Key to add.</param>
        /// <param name="values">Values to associate with that key.</param>
        /// <exception cref="ArgumentException">The key is already present in the dictionary.</exception>
        void IDictionary<TKey, ICollection<TValue>>.Add(TKey key, ICollection<TValue> values)
        {
            if (ContainsKey(key)) {
                throw new ArgumentException(Strings.KeyAlreadyPresent, "key");
            }
            else {
                AddMany(key, values);
            }
        }

        /// <summary>
        /// <para>Adds new values to be associated with a key. If duplicate values are permitted, this
        /// method always adds new key-value pairs to the dictionary.</para>
        /// <para>If duplicate values are not permitted, and <paramref name="key"/> already has a value
        /// equal to one of <paramref name="values"/> associated with it, then that value is replaced,
        /// and the number of values associate with <paramref name="key"/> is unchanged.</para>
        /// </summary>
        /// <param name="key">The key to associate with.</param>
        /// <param name="values">A collection of values to associate with <paramref name="key"/>.</param>
        public virtual void AddMany(TKey key, IEnumerable<TValue> values)
        {
            foreach (TValue value in values)
                Add(key, value);
        }

        /// <summary>
        /// Adds a new key-value pair to the dictionary.  This method must be overridden in the derived class.
        /// </summary>
        /// <param name="key">Key to add.</param>
        /// <param name="value">Value to associated with the key.</param>
        /// <exception cref="ArgumentException">key is already present in the dictionary</exception>
        public abstract void Add(TKey key, TValue value);

        /// <summary>
        /// Removes a key from the dictionary. This method must be overridden in the derived class.
        /// </summary>
        /// <param name="key">Key to remove from the dictionary.</param>
        /// <returns>True if the key was found, false otherwise.</returns>
        public abstract bool Remove(TKey key);

        /// <summary>
        /// Removes a key-value pair from the dictionary. This method must be overridden in the derived class.
        /// </summary>
        /// <param name="key">Key to remove from the dictionary.</param>
        /// <param name="value">Associated value to remove from the dictionary.</param>
        /// <returns>True if the key-value pair was found, false otherwise.</returns>
        public abstract bool Remove(TKey key, TValue value);

        /// <summary>
        /// Removes a set of values from a given key. If all values associated with a key are
        /// removed, then the key is removed also.
        /// </summary>
        /// <param name="pair">A KeyValuePair contains a key and a set of values to remove from that key.</param>
        /// <returns>True if at least one values was found and removed.</returns>
        public override bool Remove(KeyValuePair<TKey,ICollection<TValue>> pair)
        {
 	        return RemoveMany(pair.Key, pair.Value) > 0;  
        }

        /// <summary>
        /// Removes a collection of values from the values associated with a key. If the
        /// last value is removed from a key, the key is removed also.
        /// </summary>
        /// <param name="key">A key to remove values from.</param>
        /// <param name="values">A collection of values to remove.</param>
        /// <returns>The number of values that were present and removed. </returns>
        public virtual int RemoveMany(TKey key, IEnumerable<TValue> values)
        {
            int countRemoved = 0;

            foreach (TValue val in values) {
                if (Remove(key, val))
                    ++countRemoved;
            }

            return countRemoved;
        }

        /// <summary>
        /// Remove all of the keys (and any associated values) in a collection
        /// of keys. If a key is not present in the dictionary, nothing happens.
        /// </summary>
        /// <param name="keyCollection">A collection of key values to remove.</param>
        /// <returns>The number of keys from the collection that were present and removed.</returns>
        public int RemoveMany(IEnumerable<TKey> keyCollection)
        {
            int count = 0;
            foreach (TKey key in keyCollection) {
                if (Remove(key))
                    ++count;
            }

            return count;
        }


        /// <summary>
        /// Determines if this dictionary contains a key equal to <paramref name="key"/>. If so, all the values
        /// associated with that key are returned through the values parameter. This method must be
        /// overridden by the derived class.
        /// </summary>
        /// <param name="key">The key to search for.</param>
        /// <param name="values">Returns all values associated with key, if true was returned.</param>
        /// <returns>True if the dictionary contains key. False if the dictionary does not contain key.</returns>
        bool IDictionary<TKey,ICollection<TValue>>.TryGetValue(TKey key, out ICollection<TValue> values)
        {
            if (ContainsKey(key)) {
                values = this[key];
                return true;
            }
            else {
                values = null;
                return false;
            }
        }

        /// <summary>
        /// Determines whether a given key is found in the dictionary.
        /// </summary>
        /// <remarks>The default implementation simply calls TryEnumerateValuesForKey.
        /// It may be appropriate to override this method to 
        /// provide a more efficient implementation.</remarks>
        /// <param name="key">Key to look for in the dictionary.</param>
        /// <returns>True if the key is present in the dictionary.</returns>
        public virtual bool ContainsKey(TKey key)
        {
            IEnumerator<TValue> values;
            return TryEnumerateValuesForKey(key, out values);
        }

        /// <summary>
        /// Determines if this dictionary contains a key-value pair equal to <paramref name="key"/> and 
        /// <paramref name="value"/>. The dictionary is not changed. This method must be overridden in the derived class.
        /// </summary>
        /// <param name="key">The key to search for.</param>
        /// <param name="value">The value to search for.</param>
        /// <returns>True if the dictionary has associated <paramref name="value"/> with <paramref name="key"/>.</returns>
        public abstract bool Contains(TKey key, TValue value);

        /// <summary>
        /// Determines if this dictionary contains the given key and all of the values associated with that key..
        /// </summary>
        /// <param name="pair">A key and collection of values to search for.</param>
        /// <returns>True if the dictionary has associated all of the values in <paramref name="pair"/>.Value with <paramref name="pair"/>.Key.</returns>
        public override bool Contains(KeyValuePair<TKey,ICollection<TValue>> pair)
        {
            foreach (TValue val in pair.Value) {
                if (! Contains(pair.Key, val))
                    return false;
            }

            return true;
        }

        // Cache the equality comparer after we get it the first time.
        private volatile IEqualityComparer<TValue> valueEqualityComparer;

        /// <summary>
        /// If the derived class does not use the default comparison for values, this
        /// methods should be overridden to compare two values for equality. This is
        /// used for the correct implementation of ICollection.Contains on the Values
        /// and KeyValuePairs collections.
        /// </summary>
        /// <param name="value1">First value to compare.</param>
        /// <param name="value2">Second value to compare.</param>
        /// <returns>True if the values are equal.</returns>
        protected virtual bool EqualValues(TValue value1, TValue value2)
        {
            if (valueEqualityComparer == null)
                valueEqualityComparer = EqualityComparer<TValue>.Default;
            return valueEqualityComparer.Equals(value1, value2);
        }

        /// <summary>
        /// Gets a count of the number of values associated with a key. The
        /// default implementation is slow; it enumerators all of the values
        /// (using TryEnumerateValuesForKey) to count them. A derived class
        /// may be able to supply a more efficient implementation.
        /// </summary>
        /// <param name="key">The key to count values for.</param>
        /// <returns>The number of values associated with <paramref name="key"/>.</returns>
        protected virtual int CountValues(TKey key)
        {

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
xf在线a精品一区二区视频网站| 亚洲女同女同女同女同女同69| 日韩一区国产二区欧美三区| 欧美日韩免费观看一区三区| 色域天天综合网| 97成人超碰视| 色94色欧美sute亚洲13| 91一区一区三区| 一本大道av伊人久久综合| 91久久线看在观草草青青| 91福利在线导航| 欧美私人免费视频| 欧美丰满少妇xxxxx高潮对白| 欧美精品久久久久久久久老牛影院| 欧美日韩精品一区二区在线播放| 欧美日韩高清一区| 日韩欧美一区二区三区在线| 日韩一区二区三区观看| 精品国产3级a| 日本一区二区不卡视频| 亚洲视频一二三区| 亚洲一区二区三区美女| 日韩av网站在线观看| 国产在线视频一区二区| 国产精品中文欧美| 99vv1com这只有精品| 欧美亚洲综合另类| 日韩美女视频一区二区在线观看| 精品国产百合女同互慰| 国产精品久久久久毛片软件| 亚洲综合色婷婷| 免费日本视频一区| 成人午夜视频网站| 欧美系列日韩一区| 日韩女同互慰一区二区| 国产视频一区不卡| 亚洲一区二区视频在线观看| 男女性色大片免费观看一区二区 | 成人午夜看片网址| 一本色道久久加勒比精品| 欧美精品粉嫩高潮一区二区| 久久综合久久鬼色中文字| 成人免费在线播放视频| 日韩国产高清影视| 国产不卡免费视频| 欧美日韩在线三区| 久久久无码精品亚洲日韩按摩| 亚洲四区在线观看| 美女久久久精品| 成人毛片老司机大片| 欧美一区二区在线观看| 中文字幕乱码日本亚洲一区二区| 亚洲香肠在线观看| 国产福利91精品一区| 欧美唯美清纯偷拍| 国产日韩亚洲欧美综合| 亚洲国产成人av网| 成人免费精品视频| 欧美一区二区福利在线| 成人欧美一区二区三区黑人麻豆| 日本中文字幕一区| 99久久精品费精品国产一区二区| 日韩一级高清毛片| 一区二区三区日韩欧美| 国产精品亚洲第一区在线暖暖韩国| 91福利小视频| 欧美激情一区二区三区在线| 日韩av一区二区三区四区| 一本大道久久a久久综合| 国产午夜精品久久久久久久| 日韩高清在线观看| 日本韩国欧美一区| 欧美极品aⅴ影院| 美国十次了思思久久精品导航| 91玉足脚交白嫩脚丫在线播放| 精品国一区二区三区| 午夜影院久久久| 91欧美一区二区| 国产欧美一区二区精品秋霞影院| 日本在线播放一区二区三区| 欧美综合久久久| 日韩伦理电影网| 国产.欧美.日韩| 精品理论电影在线观看| 午夜精品国产更新| 欧美自拍偷拍一区| 一区二区三区四区视频精品免费 | 日韩一区二区三区电影在线观看 | 一级特黄大欧美久久久| 成人一区二区三区| 久久久久免费观看| 狠狠色狠狠色综合日日91app| 欧美精品777| 亚洲午夜激情av| 在线中文字幕一区二区| 亚洲人成人一区二区在线观看| 成人午夜在线免费| 国产精品久久看| 福利一区福利二区| 亚洲国产精品成人综合色在线婷婷 | 欧美丝袜丝交足nylons图片| 亚洲乱码中文字幕综合| 99re视频精品| 综合久久给合久久狠狠狠97色| 成人免费看视频| 亚洲欧美在线视频观看| 波多野结衣精品在线| 国产精品欧美久久久久无广告| 懂色av一区二区三区免费观看| 国产欧美日韩视频在线观看| 成人一区二区三区中文字幕| 国产精品免费网站在线观看| k8久久久一区二区三区| 亚洲色图另类专区| 欧美影院精品一区| 日本三级亚洲精品| 精品欧美一区二区三区精品久久| 狠狠色丁香婷综合久久| 久久久99精品免费观看不卡| 国产成人av电影| 亚洲欧美综合另类在线卡通| 在线免费观看一区| 日韩电影网1区2区| 欧美精品一区二区三区蜜臀 | 欧美一区二区在线播放| 麻豆91免费观看| 国产亚洲综合av| 白白色亚洲国产精品| 亚洲另类在线一区| 欧美浪妇xxxx高跟鞋交| 久久福利视频一区二区| 国产日韩精品一区二区浪潮av | 亚洲国产精品成人综合色在线婷婷 | 日日夜夜精品视频免费 | 免费看日韩a级影片| 国产日韩精品一区二区三区| 在线免费观看成人短视频| 五月天丁香久久| 26uuuu精品一区二区| 91一区二区在线| 日日夜夜免费精品视频| 国产日产精品一区| 欧美亚洲综合在线| 国产综合久久久久久鬼色 | 精品一区二区在线看| 日本一区二区视频在线| 91传媒视频在线播放| 美女网站一区二区| 中文字幕一区二区在线播放| 欧美日韩国产一区二区三区地区| 激情六月婷婷久久| 亚洲日本va在线观看| 欧美日韩国产大片| 国产综合成人久久大片91| 亚洲精品日韩一| 精品国产在天天线2019| 91麻豆成人久久精品二区三区| 青青草成人在线观看| 亚洲人成网站在线| 久久品道一品道久久精品| 在线观看一区二区视频| 国产成人免费视频精品含羞草妖精| 亚洲专区一二三| 国产女人18毛片水真多成人如厕| 欧美日韩国产小视频| 成人黄色av电影| 久久国产乱子精品免费女| 1000精品久久久久久久久| 精品少妇一区二区三区免费观看| 色综合久久综合| 国产激情视频一区二区在线观看| 在线欧美一区二区| 7777精品伊人久久久大香线蕉完整版 | 国产91对白在线观看九色| 亚瑟在线精品视频| 综合激情成人伊人| 国产日韩欧美电影| 日韩精品资源二区在线| 欧美天天综合网| 色就色 综合激情| 成人在线综合网站| 国内精品嫩模私拍在线| 日韩av电影免费观看高清完整版 | 成人精品一区二区三区四区| 蜜桃av一区二区| 一区二区三区四区高清精品免费观看 | 国产精品一级二级三级| 亚洲国产cao| 亚洲欧美一区二区三区国产精品| 欧美成人免费网站| 91精品国产乱| 欧美日韩精品一区视频| 99re热这里只有精品免费视频| 国产一区二区在线观看免费| 自拍偷拍亚洲欧美日韩| 91精品在线一区二区| 色噜噜狠狠一区二区三区果冻| 国产91清纯白嫩初高中在线观看| 久久成人免费网| 亚洲不卡av一区二区三区|