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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? readonlymultidictionarybase.cs

?? C#寫的類似于STL的集合類,首先是C#編寫,可以用于.net變程.
?? CS
?? 第 1 頁 / 共 2 頁
字號:
?//******************************
// 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. The resulting collection
    /// is read-only -- items cannot be added or removed.
    /// </summary>
    /// <remarks>
    /// <para>To use ReadOnlyMultiDictionaryBase as a base class, the derived class must override
    /// Count, Contains(TKey,TValue), EnumerateKeys, and TryEnumerateValuesForKey . </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 ReadOnlyMultiDictionaryBase<TKey, TValue> : ReadOnlyCollectionBase<KeyValuePair<TKey, ICollection<TValue>>>,
                                                                                               IDictionary<TKey, ICollection<TValue>>
    {
        /// <summary>
        /// Creates a new ReadOnlyMultiDictionaryBase. 
        /// </summary>
        protected ReadOnlyMultiDictionaryBase()
        {
        }

        /// <summary>
        /// Throws an NotSupportedException stating that this collection cannot be modified.
        /// </summary>
        private void MethodModifiesCollection()
        {
            throw new NotSupportedException(string.Format(Strings.CannotModifyCollection, Util.SimpleClassName(this.GetType())));
        }

        /// <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>
        /// 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)
        {
            MethodModifiesCollection();
        }

        /// <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>
        bool IDictionary<TKey, ICollection<TValue>>.Remove(TKey key)
        {
            MethodModifiesCollection();
            return false;  // never reached.
        }

        /// <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 TryGetValue.
        /// 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)
        {
            int count = 0;
            IEnumerator<TValue> enumValues;

            if (TryEnumerateValuesForKey(key, out enumValues)) {
                using (enumValues) {
                    while (enumValues.MoveNext())
                        count += 1;
                }
            }

            return count;
        }

        /// <summary>
        /// Gets a total count of values in the collection. This default implementation
        /// is slow; it enumerates all of the keys in the dictionary and calls CountValues on each.
        /// A derived class may be able to supply a more efficient implementation.
        /// </summary>
        /// <returns>The total number of values associated with all keys in the dictionary.</returns>
        protected virtual int CountAllValues()
        {
            int count = 0;

            using (IEnumerator<TKey> enumKeys = EnumerateKeys()) {
                while (enumKeys.MoveNext()) {
                    TKey key = enumKeys.Current;
                    count += CountValues(key);
                }
            }

            return count;
        }

        /// <summary>
        /// Gets a read-only collection all the keys in this dictionary.
        /// </summary>
        /// <value>An readonly ICollection&lt;TKey&gt; of all the keys in this dictionary.</value>
        public virtual ICollection<TKey> Keys
        {
            get { return new KeysCollection(this); }
        }

        /// <summary>
        /// Gets a read-only collection of all the values in the dictionary. 
        /// </summary>
        /// <returns>A read-only ICollection&lt;TValue&gt; of all the values in the dictionary.</returns>
        public virtual ICollection<TValue> Values
        {
            get { return new ValuesCollection(this); }
        }

        /// <summary>
        /// Gets a read-only collection of all the value collections in the dictionary. 
        /// </summary>
        /// <returns>A read-only ICollection&lt;IEnumerable&lt;TValue&gt;&gt; of all the values in the dictionary.</returns>
        ICollection<ICollection<TValue>> IDictionary<TKey, ICollection<TValue>>.Values
        {
            get { return new EnumerableValuesCollection(this); }
        }

        /// <summary>
        /// Gets a read-only collection of all key-value pairs in the dictionary. If a key has multiple
        /// values associated with it, then a key-value pair is present for each value associated
        /// with the key.
        /// </summary>
        public virtual ICollection<KeyValuePair<TKey, TValue>> KeyValuePairs
        {
            get { return new KeyValuePairsCollection(this); }
        }

        /// <summary>
        /// Returns a collection of all of the values in the dictionary associated with <paramref name="key"/>.
        /// If the key is not present in the dictionary, an ICollection with no
        /// values is returned. The returned ICollection is read-only.
        /// </summary>
        /// <param name="key">The key to get the values associated with.</param>
        /// <value>An ICollection&lt;TValue&gt; with all the values associated with <paramref name="key"/>.</value>
        public virtual ICollection<TValue> this[TKey key]
        {
            get
            {
                return new ValuesForKeyCollection(this, key);
            }
        }

        /// <summary>
        /// Gets a collection of all the values in the dictionary associated with <paramref name="key"/>.
        /// If the key is not present in the dictionary, a KeyNotFound exception is thrown.
        /// </summary>
        /// <param name="key">The key to get the values associated with.</param>
        /// <value>An IEnumerable&lt;TValue&gt; that enumerates all the values associated with <paramref name="key"/>.</value>
        /// <exception cref="KeyNotFoundException">The given key is not present in the dictionary.</exception>
        /// <exception cref="NotSupportedException">The set accessor is called.</exception>
        ICollection<TValue> IDictionary<TKey, ICollection<TValue>>.this[TKey key]
        {
            get
            {
                if (ContainsKey(key))
                    return new ValuesForKeyCollection(this, key);
                else
                    throw new KeyNotFoundException(Strings.KeyNotFound);
            }
            set
            {
                MethodModifiesCollection();
            }
        }

        /// <summary>
        /// Shows the string representation of the dictionary. The string representation contains
        /// a list of the mappings in the dictionary.
        /// </summary>
        /// <returns>The string representation of the dictionary.</returns>
        public override string ToString()
        {
            bool firstItem = true;

            System.Text.StringBuilder builder = new System.Text.StringBuilder();

            builder.Append("{");

            // Call ToString on each item and put it in.
            foreach (KeyValuePair<TKey, ICollection<TValue>> pair in this) {
                if (!firstItem)
                    builder.Append(", ");

                if (pair.Key == null)
                    builder.Append("null");
                else
                    builder.Append(pair.Key.ToString());

                builder.Append("->");

                // Put all values in a parenthesized list.
                builder.Append('(');

                bool firstValue = true;
                foreach (TValue val in pair.Value) {
                    if (!firstValue)
                        builder.Append(",");

                    if (val == null)
                        builder.Append("null");
                    else
                        builder.Append(val.ToString());

                    firstValue = false;
                }

                builder.Append(')');

                firstItem = false;
            }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
免费久久99精品国产| 久久精品亚洲国产奇米99| 91黄视频在线观看| 精品欧美久久久| 国产日韩欧美一区二区三区综合| 青青草国产精品亚洲专区无| 欧美精品一二三| 色婷婷综合久久久久中文 | 欧美综合一区二区三区| 激情综合五月婷婷| 色呦呦国产精品| 亚洲三级小视频| 处破女av一区二区| 2021中文字幕一区亚洲| 全国精品久久少妇| 成人午夜又粗又硬又大| 久久久美女毛片| 六月丁香婷婷久久| 日韩色视频在线观看| 亚洲www啪成人一区二区麻豆| 白白色 亚洲乱淫| 一区二区三区在线播放| 国产麻豆精品一区二区| 精品国产91久久久久久久妲己| 婷婷夜色潮精品综合在线| 色偷偷88欧美精品久久久| 亚洲欧洲99久久| 91香蕉视频污| 婷婷成人综合网| 精品久久久久久久久久久久包黑料 | 婷婷一区二区三区| 欧美精品一二三四| 福利一区福利二区| 成人欧美一区二区三区黑人麻豆| 不卡一区中文字幕| 亚洲成人自拍一区| 久久免费美女视频| 91啪亚洲精品| 国产精品自拍一区| 亚洲精品少妇30p| 久久综合99re88久久爱| 成人激情校园春色| 蜜臀精品久久久久久蜜臀 | 一区二区三区高清在线| 91麻豆精品国产91久久久使用方法| 精品一区二区三区的国产在线播放| 日本一区二区动态图| 欧美日产在线观看| 91浏览器打开| 成人av在线电影| 国产一区二区三区观看| 亚洲一区二区av电影| 中文字幕一区二区在线观看| 91精品国产福利在线观看| 色菇凉天天综合网| 国产精品系列在线观看| 韩国av一区二区三区在线观看| 偷拍与自拍一区| 亚洲精品你懂的| 亚洲综合视频在线| 亚洲精品日产精品乱码不卡| 亚洲天堂免费看| 国产精品久久久久国产精品日日| 欧美mv日韩mv国产网站app| 91精品在线一区二区| 欧美r级在线观看| 日韩欧美在线不卡| 欧美一区二区三区在| 日韩精品一区二区三区四区视频 | 精品国产一区二区三区忘忧草| 欧美一区二区福利视频| 精品久久久久久久久久久久包黑料 | 日韩av中文字幕一区二区三区| 亚洲伦在线观看| 裸体健美xxxx欧美裸体表演| 国产精品亚洲成人| 91福利国产成人精品照片| 欧美日韩国产一级二级| 337p粉嫩大胆噜噜噜噜噜91av| 国产欧美精品国产国产专区| 一区二区三区不卡视频| 麻豆成人av在线| 欧美专区亚洲专区| 久久久久久99久久久精品网站| 国产精品久久久久久久浪潮网站| 午夜欧美电影在线观看| 国产成人精品一区二区三区网站观看| 91天堂素人约啪| 国产夜色精品一区二区av| 日韩av二区在线播放| 在线观看国产日韩| 中文字幕在线播放不卡一区| 激情综合网天天干| 日韩欧美在线1卡| 狠狠色丁香婷婷综合| 亚洲欧美日韩一区| 欧美一区午夜视频在线观看| 国产一区二区三区四区五区入口| 成人免费视频视频| 欧美视频在线一区| 亚洲欧美国产毛片在线| 99久久精品免费| 91麻豆精品国产自产在线观看一区| 日韩一区中文字幕| 91在线视频官网| 欧美日韩免费观看一区二区三区| 国产精品久久毛片| www.成人在线| 亚洲一区在线视频| 6080yy午夜一二三区久久| 亚洲午夜一二三区视频| 欧洲精品一区二区| 日韩精品色哟哟| 日韩欧美区一区二| 99在线热播精品免费| 亚洲一二三四久久| 精品久久五月天| 日本美女一区二区| 国产午夜精品一区二区三区嫩草| 国产91精品一区二区麻豆网站| 国产欧美精品国产国产专区 | www.成人在线| 日韩精品久久理论片| 中文字幕一区二区三区av| 777a∨成人精品桃花网| 久久99最新地址| 精品视频一区二区不卡| 成人av在线一区二区三区| 综合在线观看色| 欧美大尺度电影在线| 91成人在线观看喷潮| 粉嫩av一区二区三区粉嫩| 亚洲综合视频网| 亚洲色图20p| 欧美激情一区二区在线| 欧美一区二区大片| 91精品国产综合久久小美女| 成人av资源在线| 福利电影一区二区| 国产福利视频一区二区三区| 久久99国产精品成人| 免费观看在线综合色| 香蕉久久一区二区不卡无毒影院 | 精品成人一区二区| 精品国产三级a在线观看| 欧美日韩视频在线一区二区 | 国产日韩欧美不卡在线| 久久久久久久电影| 国产精品久久午夜夜伦鲁鲁| 亚洲三级在线免费| 日韩高清一区在线| k8久久久一区二区三区| av亚洲精华国产精华| 欧美视频自拍偷拍| 国产日产欧美一区| 一区二区三区视频在线看| 五月激情综合网| 成人听书哪个软件好| 成人高清免费观看| 91国产丝袜在线播放| 日韩一区二区三区在线视频| 日韩女优电影在线观看| 亚洲男人的天堂av| 蜜臀a∨国产成人精品| 色综合久久久久久久| 欧美性生活大片视频| 国产欧美日韩激情| 亚洲国产人成综合网站| 国产jizzjizz一区二区| 欧美片网站yy| 国产精品成人午夜| 麻豆91精品视频| 欧美羞羞免费网站| 成人免费小视频| 国产精品白丝av| 国产色产综合产在线视频| 亚洲影视在线播放| 欧美亚洲自拍偷拍| 亚洲成人自拍一区| 欧美在线观看视频在线| 亚洲激情男女视频| 91网站黄www| 亚洲精品免费在线观看| 91精品1区2区| 午夜国产不卡在线观看视频| 欧美探花视频资源| 亚洲图片自拍偷拍| 91精品国产综合久久婷婷香蕉 | 一区二区三区欧美视频| 色婷婷综合视频在线观看| 午夜av一区二区三区| 精品国产污网站| 色综合天天综合| 日韩国产成人精品| 国产精品国产三级国产专播品爱网| jlzzjlzz国产精品久久| 偷拍自拍另类欧美| 国产精品久久精品日日| 欧美性色黄大片手机版| 国产一区二区影院|