// Decompiled with JetBrains decompiler
// Type: System.Collections.Generic.Dictionary`2
// Assembly: mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// MVID: 05D3C3EF-C0FC-47FC-86AA-85E3AEE95C4B
// Assembly location: C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll
using System;
using System.Collections;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Security;
namespace System.Collections.Generic
{
/// <summary>
/// 表示键和值的集合。若要浏览此类型的.NET Framework 源代码,请参阅 Reference Source。
/// </summary>
/// <typeparam name="TKey">字典中的键的类型。</typeparam><typeparam name="TValue">字典中的值的类型。</typeparam><filterpriority>1</filterpriority>
[DebuggerTypeProxy(typeof (Mscorlib_DictionaryDebugView<,>))]
[DebuggerDisplay("Count = {Count}")]
[ComVisible(false)]
[__DynamicallyInvokable]
[Serializable]
public class Dictionary<TKey, TValue> : IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable, IDictionary, ICollection, IReadOnlyDictionary<TKey, TValue>, IReadOnlyCollection<KeyValuePair<TKey, TValue>>, ISerializable, IDeserializationCallback
{
/// <summary>
/// 初始化 <see cref="T:System.Collections.Generic.Dictionary`2"/> 类的新实例,该实例为空,具有默认的初始容量并为键类型使用默认的相等比较器。
/// </summary>
[__DynamicallyInvokable]
public Dictionary();
/// <summary>
/// 初始化 <see cref="T:System.Collections.Generic.Dictionary`2"/> 类的新实例,该实例为空,具有指定的初始容量并为键类型使用默认的相等比较器。
/// </summary>
/// <param name="capacity"><see cref="T:System.Collections.Generic.Dictionary`2"/> 可包含的初始元素数。</param><exception cref="T:System.ArgumentOutOfRangeException"><paramref name="capacity"/> 小于 0。</exception>
[__DynamicallyInvokable]
public Dictionary(int capacity);
/// <summary>
/// 初始化 <see cref="T:System.Collections.Generic.Dictionary`2"/> 类的新实例,该实例为空,具有默认的初始容量并使用指定的 <see cref="T:System.Collections.Generic.IEqualityComparer`1"/>。
/// </summary>
/// <param name="comparer">比较键时要使用的 <see cref="T:System.Collections.Generic.IEqualityComparer`1"/> 实现,或者为 null,以便为键类型使用默认的 <see cref="T:System.Collections.Generic.EqualityComparer`1"/>。</param>
[__DynamicallyInvokable]
public Dictionary(IEqualityComparer<TKey> comparer);
/// <summary>
/// 初始化 <see cref="T:System.Collections.Generic.Dictionary`2"/> 类的新实例,该实例为空,具有指定的初始容量并使用指定的 <see cref="T:System.Collections.Generic.IEqualityComparer`1"/>。
/// </summary>
/// <param name="capacity"><see cref="T:System.Collections.Generic.Dictionary`2"/> 可包含的初始元素数。</param><param name="comparer">比较键时要使用的 <see cref="T:System.Collections.Generic.IEqualityComparer`1"/> 实现,或者为 null,以便为键类型使用默认的 <see cref="T:System.Collections.Generic.EqualityComparer`1"/>。</param><exception cref="T:System.ArgumentOutOfRangeException"><paramref name="capacity"/> 小于 0。</exception>
[__DynamicallyInvokable]
public Dictionary(int capacity, IEqualityComparer<TKey> comparer);
/// <summary>
/// 初始化 <see cref="T:System.Collections.Generic.Dictionary`2"/> 类的新实例,该实例包含从指定的 <see cref="T:System.Collections.Generic.IDictionary`2"/> 复制的元素并为键类型使用默认的相等比较器。
/// </summary>
/// <param name="dictionary"><see cref="T:System.Collections.Generic.IDictionary`2"/>,它的元素被复制到新 <see cref="T:System.Collections.Generic.Dictionary`2"/>。</param><exception cref="T:System.ArgumentNullException"><paramref name="dictionary"/> 为 null。</exception><exception cref="T:System.ArgumentException"><paramref name="dictionary"/> 包含一个或多个重复键。</exception>
[__DynamicallyInvokable]
public Dictionary(IDictionary<TKey, TValue> dictionary);
/// <summary>
/// 初始化 <see cref="T:System.Collections.Generic.Dictionary`2"/> 类的新实例,该实例包含从指定的 <see cref="T:System.Collections.Generic.IDictionary`2"/> 中复制的元素并使用指定的 <see cref="T:System.Collections.Generic.IEqualityComparer`1"/>。
/// </summary>
/// <param name="dictionary"><see cref="T:System.Collections.Generic.IDictionary`2"/>,它的元素被复制到新 <see cref="T:System.Collections.Generic.Dictionary`2"/>。</param><param name="comparer">比较键时要使用的 <see cref="T:System.Collections.Generic.IEqualityComparer`1"/> 实现,或者为 null,以便为键类型使用默认的 <see cref="T:System.Collections.Generic.EqualityComparer`1"/>。</param><exception cref="T:System.ArgumentNullException"><paramref name="dictionary"/> 为 null。</exception><exception cref="T:System.ArgumentException"><paramref name="dictionary"/> 包含一个或多个重复键。</exception>
[__DynamicallyInvokable]
public Dictionary(IDictionary<TKey, TValue> dictionary, IEqualityComparer<TKey> comparer);
/// <summary>
/// 用序列化数据初始化 <see cref="T:System.Collections.Generic.Dictionary`2"/> 类的新实例。
/// </summary>
/// <param name="info">一个 <see cref="T:System.Runtime.Serialization.SerializationInfo"/> 对象包含序列化 <see cref="T:System.Collections.Generic.Dictionary`2"/> 所需的信息。</param><param name="context">一个 <see cref="T:System.Runtime.Serialization.StreamingContext"/> 结构包含与 <see cref="T:System.Collections.Generic.Dictionary`2"/> 关联的序列化流的源和目标。</param>
protected Dictionary(SerializationInfo info, StreamingContext context);
/// <summary>
/// 将指定的键和值添加到字典中。
/// </summary>
/// <param name="key">要添加的元素的键。</param><param name="value">要添加的元素的值。对于引用类型,该值可以为 null。</param><exception cref="T:System.ArgumentNullException"><paramref name="key"/> 为 null。</exception><exception cref="T:System.ArgumentException"><see cref="T:System.Collections.Generic.Dictionary`2"/> 中已存在具有相同键的元素。</exception>
[__DynamicallyInvokable]
public void Add(TKey key, TValue value);
[__DynamicallyInvokable]
void ICollection<KeyValuePair<TKey, TValue>>.Add(KeyValuePair<TKey, TValue> keyValuePair);
[__DynamicallyInvokable]
bool ICollection<KeyValuePair<TKey, TValue>>.Contains(KeyValuePair<TKey, TValue> keyValuePair);
[__DynamicallyInvokable]
bool ICollection<KeyValuePair<TKey, TValue>>.Remove(KeyValuePair<TKey, TValue> keyValuePair);
/// <summary>
/// 将所有键和值从 <see cref="T:System.Collections.Generic.Dictionary`2"/> 中移除。
/// </summary>
[__DynamicallyInvokable]
public void Clear();
/// <summary>
/// 确定是否 <see cref="T:System.Collections.Generic.Dictionary`2"/> 包含指定键。
/// </summary>
///
/// <returns>
/// 如果 true 包含具有指定键的元素,则为 <see cref="T:System.Collections.Generic.Dictionary`2"/>;否则为 false。
/// </returns>
/// <param name="key">要在 <see cref="T:System.Collections.Generic.Dictionary`2"/> 中定位的键。</param><exception cref="T:System.ArgumentNullException"><paramref name="key"/> 为 null。</exception>
[__DynamicallyInvokable]
public bool ContainsKey(TKey key);
/// <summary>
/// 确定 <see cref="T:System.Collections.Generic.Dictionary`2"/> 是否包含特定值。
/// </summary>
///
/// <returns>
/// 如果 true 包含具有指定值的元素,则为 <see cref="T:System.Collections.Generic.Dictionary`2"/>;否则为 false。
/// </returns>
/// <param name="value">要在 <see cref="T:System.Collections.Generic.Dictionary`2"/> 中定位的值。对于引用类型,该值可以为 null。</param>
[__DynamicallyInvokable]
public bool ContainsValue(TValue value);
/// <summary>
/// 返回循环访问 <see cref="T:System.Collections.Generic.Dictionary`2"/> 的枚举数。
/// </summary>
///
/// <returns>
/// 用于 <see cref="T:System.Collections.Generic.Dictionary`2"/> 的 <see cref="T:System.Collections.Generic.Dictionary`2.Enumerator"/> 结构。
/// </returns>
[__DynamicallyInvokable]
public Dictionary<TKey, TValue>.Enumerator GetEnumerator();
[__DynamicallyInvokable]
IEnumerator<KeyValuePair<TKey, TValue>> IEnumerable<KeyValuePair<TKey, TValue>>.GetEnumerator();
/// <summary>
/// 实现 <see cref="T:System.Runtime.Serialization.ISerializable"/> 接口,并返回序列化 <see cref="T:System.Collections.Generic.Dictionary`2"/> 实例所需的数据。
/// </summary>
/// <param name="info"><see cref="T:System.Runtime.Serialization.SerializationInfo"/> 对象,该对象包含序列化 <see cref="T:System.Collections.Generic.Dictionary`2"/> 实例所需的信息。</param><param name="context">一个 <see cref="T:System.Runtime.Serialization.StreamingContext"/> 结构,它包含与 <see cref="T:System.Collections.Generic.Dictionary`2"/> 实例关联的序列化流的源和目标。</param><exception cref="T:System.ArgumentNullException"><paramref name="info"/> 为 null。</exception>
[SecurityCritical]
public virtual void GetObjectData(SerializationInfo info, StreamingContext context);
/// <summary>
/// 实现 <see cref="T:System.Runtime.Serialization.ISerializable"/> 接口,并在完成反序列化之后引发反序列化事件。
/// </summary>
/// <param name="sender">反序列化事件源。</param><exception cref="T:System.Runtime.Serialization.SerializationException">与当前 <see cref="T:System.Runtime.Serialization.SerializationInfo"/> 实例关联的 <see cref="T:System.Collections.Generic.Dictionary`2"/> 对象无效。</exception>
public virtual void OnDeserialization(object sender);
/// <summary>
/// 将带有指定键的值从 <see cref="T:System.Collections.Generic.Dictionary`2"/> 中移除。
/// </summary>
///
/// <returns>
/// 如果成功找到并移除该元素,则为 true;否则为 false。如果在 <see cref="T:System.Collections.Generic.Dictionary`2"/> 中没有找到 <paramref name="key"/>,则此方法返回 false。
/// </returns>
/// <param name="key">要移除的元素的键。</param><exception cref="T:System.ArgumentNullException"><paramref name="key"/> 为 null。</exception>
[__DynamicallyInvokable]
public bool Remove(TKey key);
/// <summary>
/// 获取与指定键关联的值。
/// </summary>
///
/// <returns>
/// 如果 true 包含具有指定键的元素,则为 <see cref="T:System.Collections.Generic.Dictionary`2"/>;否则为 false。
/// </returns>
/// <param name="key">要获取的值的键。</param><param name="value">当此方法返回时,如果找到指定键,则包含与该键相关的值;否则包含 <paramref name="value"/> 参数类型的默认值。此参数未经初始化即被传递。</param><exception cref="T:System.ArgumentNullException"><paramref name="key"/> 为 null。</exception>
[__DynamicallyInvokable]
public bool TryGetValue(TKey key, out TValue value);
[__DynamicallyInvokable]
void ICollection<KeyValuePair<TKey, TValue>>.CopyTo(KeyValuePair<TKey, TValue>[] array, int index);
/// <summary>
/// 从特定的数组索引处开始,将 <see cref="T:System.Collections.Generic.ICollection`1"/> 的元素复制到一个数组中。
/// </summary>
/// <param name="array">一维数组,用作从 <see cref="T:System.Collections.Generic.ICollection`1"/> 复制的元素的目标位置。该数组的索引必须从零开始。</param><param name="index"><paramref name="array"/> 中从零开始的索引,从此处开始复制。</param><exception cref="T:System.ArgumentNullException"><paramref name="array"/> 为 null。</exception><exception cref="T:System.ArgumentOutOfRangeException"><paramref name="index"/> 小于 0。</exception><exception cref="T:System.ArgumentException"><paramref name="array"/> 是多维的。- 或 -<paramref name="array"/> 没有从零开始的索引。- 或 -源 <see cref="T:System.Collections.Generic.ICollection`1"/> 中的元素数目大于从 <paramref name="index"/> 到目标 <paramref name="array"/> 末尾之间的可用空间。- 或 -源 <see cref="T:System.Collections.Generic.ICollection`1"/> 的类型无法自动转换为目标 <paramref name="array"/> 的类型。</exception>
[__DynamicallyInvokable]
void ICollection.CopyTo(Array array, int index);
/// <summary>
/// 返回一个循环访问集合的枚举器。
/// </summary>
///
/// <returns>
/// 可用于循环访问集合的 <see cref="T:System.Collections.IEnumerator"/>。
/// </returns>
[__DynamicallyInvokable]
IEnumerator IEnumerable.GetEnumerator();
/// <summary>
/// 将指定的键和值添加到字典中。
/// </summary>
/// <param name="key">要用作键的对象。</param><param name="value">要用作值的对象。</param><exception cref="T:System.ArgumentNullException"><paramref name="key"/> 为 null。</exception><exception cref="T:System.ArgumentException"><paramref name="key"/> 属于不能分配给 <paramref name="TKey"/> 的键类型 <see cref="T:System.Collections.Generic.Dictionary`2"/> 的类型。- 或 -<paramref name="value"/> 属于不能分配给 <paramref name="TValue"/>(<see cref="T:System.Collections.Generic.Dictionary`2"/> 中的值的类型)的类型。- 或 -<see cref="T:System.Collections.Generic.Dictionary`2"/> 中已存在相同键的值。</exception>
[__DynamicallyInvokable]
void IDictionary.Add(object key, object value);
/// <summary>
/// 确定是否 <see cref="T:System.Collections.IDictionary"/> 包含带有指定键的元素。
/// </summary>
///
/// <returns>
/// 如果 true 包含具有指定键的元素,则为 <see cref="T:System.Collections.IDictionary"/>;否则为 false。
/// </returns>
/// <param name="key">要在 <see cref="T:System.Collections.IDictionary"/> 中定位的键。</param><exception cref="T:System.ArgumentNullException"><paramref name="key"/> 为 null。</exception>
[__DynamicallyInvokable]
bool IDictionary.Contains(object key);
/// <summary>
/// 返回 <see cref="T:System.Collections.IDictionaryEnumerator"/> 的 <see cref="T:System.Collections.IDictionary"/>。
/// </summary>
///
/// <returns>
/// 用于 <see cref="T:System.Collections.IDictionaryEnumerator"/> 的 <see cref="T:System.Collections.IDictionary"/>。
/// </returns>
[__DynamicallyInvokable]
IDictionaryEnumerator IDictionary.GetEnumerator();
/// <summary>
/// 从 <see cref="T:System.Collections.IDictionary"/> 中移除带有指定键的元素。
/// </summary>
/// <param name="key">要移除的元素的键。</param><exception cref="T:System.ArgumentNullException"><paramref name="key"/> 为 null。</exception>
[__DynamicallyInvokable]
void IDictionary.Remove(object key);
/// <summary>
/// 获取用于确定字典中的键是否相等的 <see cref="T:System.Collections.Generic.IEqualityComparer`1"/>。
/// </summary>
///
/// <returns>
/// <see cref="T:System.Collections.Generic.IEqualityComparer`1"/> 泛型接口实现,它用于确定当前 <see cref="T:System.Collections.Generic.Dictionary`2"/> 中的键是否相等并为键提供哈希值。
/// </returns>
[__DynamicallyInvokable]
public IEqualityComparer<TKey> Comparer { [__DynamicallyInvokable] get; }
/// <summary>
/// 获取包含在 <see cref="T:System.Collections.Generic.Dictionary`2"/> 中的键/值对的数目。
/// </summary>
///
/// <returns>
/// 包含在 <see cref="T:System.Collections.Generic.Dictionary`2"/> 中的键/值对的数目。
/// </returns>
[__DynamicallyInvokable]
public int Count { [__DynamicallyInvokable] get; }
/// <summary>
/// 获得一个包含 <see cref="T:System.Collections.Generic.Dictionary`2"/> 中的键的集合。
/// </summary>
///
/// <returns>
/// 一个 <see cref="T:System.Collections.Generic.Dictionary`2.KeyCollection"/>,包含 <see cref="T:System.Collections.Generic.Dictionary`2"/> 中的键。
/// </returns>
[__DynamicallyInvokable]
public Dictionary<TKey, TValue>.KeyCollection Keys { [__DynamicallyInvokable] get; }
/// <summary>
/// 获取包含 <see cref="T:System.Collections.Generic.ICollection`1"/> 的键的 <see cref="T:System.Collections.Generic.IDictionary`2"/>。
/// </summary>
///
/// <returns>
/// 包含 <see cref="T:System.Collections.Generic.IDictionary`2"/> 的键的类型 <paramref name="TKey"/> 的 <see cref="T:System.Collections.Generic.ICollection`1"/>。
/// </returns>
[__DynamicallyInvokable]
ICollection<TKey> IDictionary<TKey, TValue>.Keys { [__DynamicallyInvokable] get; }
/// <summary>
/// 获得一个包含 <see cref="T:System.Collections.Generic.IReadOnlyDictionary`2"/> 的键的集合。
/// </summary>
///
/// <returns>
/// 一个包含 <see cref="T:System.Collections.Generic.IReadOnlyDictionary`2"/> 的键的集合。
/// </returns>
[__DynamicallyInvokable]
IEnumerable<TKey> IReadOnlyDictionary<TKey, TValue>.Keys { [__DynamicallyInvokable] get; }
/// <summary>
/// 获得一个包含 <see cref="T:System.Collections.Generic.Dictionary`2"/> 中的值的集合。
/// </summary>
///
/// <returns>
/// 一个 <see cref="T:System.Collections.Generic.Dictionary`2.ValueCollection"/>,包含 <see cref="T:System.Collections.Generic.Dictionary`2"/> 中的值。
/// </returns>
[__DynamicallyInvokable]
public Dictionary<TKey, TValue>.ValueCollection Values { [__DynamicallyInvokable] get; }
/// <summary>
/// 获取一个 <see cref="T:System.Collections.Generic.ICollection`1"/>,它包含 <see cref="T:System.Collections.Generic.IDictionary`2"/> 中的值。
/// </summary>
///
/// <returns>
/// 包含 <see cref="T:System.Collections.Generic.IDictionary`2"/> 中的值的类型 <paramref name="TValue"/> 的 <see cref="T:System.Collections.Generic.ICollection`1"/>。
/// </returns>
[__DynamicallyInvokable]
ICollection<TValue> IDictionary<TKey, TValue>.Values { [__DynamicallyInvokable] get; }
/// <summary>
/// 获得一个包含 <see cref="T:System.Collections.Generic.IReadOnlyDictionary`2"/> 的值的集合。
/// </summary>
///
/// <returns>
/// 一个包含 <see cref="T:System.Collections.Generic.IReadOnlyDictionary`2"/> 的值的集合。
/// </returns>
[__DynamicallyInvokable]
IEnumerable<TValue> IReadOnlyDictionary<TKey, TValue>.Values { [__DynamicallyInvokable] get; }
/// <summary>
/// 获取或设置与指定的键关联的值。
/// </summary>
///
/// <returns>
/// 与指定的键相关联的值。如果指定键未找到,则 Get 操作引发 <see cref="T:System.Collections.Generic.KeyNotFoundException"/>,而 Set 操作创建一个带指定键的新元素。
/// </returns>
/// <param name="key">要获取或设置的值的键。</param><exception cref="T:System.ArgumentNullException"><paramref name="key"/> 为 null。</exception><exception cref="T:System.Collections.Generic.KeyNotFoundException">已检索该属性,并且集合中不存在 <paramref name="key"/>。</exception>
[__DynamicallyInvokable]
public TValue this[TKey key] { [__DynamicallyInvokable] get; [__DynamicallyInvokable] set; }
[__DynamicallyInvokable]
bool ICollection<KeyValuePair<TKey, TValue>>.IsReadOnly { [__DynamicallyInvokable] get; }
/// <summary>
/// 获取一个值,该值指示是否同步对 <see cref="T:System.Collections.ICollection"/> 的访问(线程安全)。
/// </summary>
///
/// <returns>
/// 如果对 true 的访问是同步的(线程安全),则为 <see cref="T:System.Collections.ICollection"/>;否则为 false。在 <see cref="T:System.Collections.Generic.Dictionary`2"/> 的默认实现中,此属性始终返回 false。
/// </returns>
[__DynamicallyInvokable]
bool ICollection.IsSynchronized { [__DynamicallyInvokable] get; }
/// <summary>
/// 获取可用于同步对 <see cref="T:System.Collections.ICollection"/> 的访问的对象。
/// </summary>
///
/// <returns>
/// 可用于同步对 <see cref="T:System.Collections.ICollection"/> 的访问的对象。
/// </returns>
[__DynamicallyInvokable]
object ICollection.SyncRoot { [__DynamicallyInvokable] get; }
/// <summary>
/// 获取一个值,该值指示 <see cref="T:System.Collections.IDictionary"/> 是否具有固定大小。
/// </summary>
///
/// <returns>
/// 如果 true 具有固定大小,则为 <see cref="T:System.Collections.IDictionary"/>;否则为 false。在 <see cref="T:System.Collections.Generic.Dictionary`2"/> 的默认实现中,此属性始终返回 false。
/// </returns>
[__DynamicallyInvokable]
bool IDictionary.IsFixedSize { [__DynamicallyInvokable] get; }
/// <summary>
/// 获取一个值,该值指示 <see cref="T:System.Collections.IDictionary"/> 是否为只读。
/// </summary>
///
/// <returns>
/// 如果 true 是只读的,则为 <see cref="T:System.Collections.IDictionary"/>;否则为 false。在 <see cref="T:System.Collections.Generic.Dictionary`2"/> 的默认实现中,此属性始终返回 false。
/// </returns>
[__DynamicallyInvokable]
bool IDictionary.IsReadOnly { [__DynamicallyInvokable] get; }
/// <summary>
/// 获取包含 <see cref="T:System.Collections.ICollection"/> 的键的 <see cref="T:System.Collections.IDictionary"/>。
/// </summary>
///
/// <returns>
/// 一个 <see cref="T:System.Collections.ICollection"/>,包含 <see cref="T:System.Collections.IDictionary"/> 的键。
/// </returns>
[__DynamicallyInvokable]
ICollection IDictionary.Keys { [__DynamicallyInvokable] get; }
/// <summary>
/// 获取一个 <see cref="T:System.Collections.ICollection"/>,它包含 <see cref="T:System.Collections.IDictionary"/> 中的值。
/// </summary>
///
/// <returns>
/// 一个 <see cref="T:System.Collections.ICollection"/>,它包含 <see cref="T:System.Collections.IDictionary"/> 中的值。
/// </returns>
[__DynamicallyInvokable]
ICollection IDictionary.Values { [__DynamicallyInvokable] get; }
/// <summary>
/// 获取或设置具有指定键的值。
/// </summary>
///
/// <returns>
/// 如果 <paramref name="key"/> 不在字典中或 <paramref name="key"/> 的类型属于不可分配给 <see cref="T:System.Collections.Generic.Dictionary`2"/> 的键类型 <paramref name="TKey"/>,则为与指定的键关联的值或为 null。
/// </returns>
/// <param name="key">要获取的值的键。</param><exception cref="T:System.ArgumentNullException"><paramref name="key"/> 为 null。</exception><exception cref="T:System.ArgumentException">正在分配值,并且 <paramref name="key"/> 属于不能分配给 <paramref name="TKey"/> 的键类型 <see cref="T:System.Collections.Generic.Dictionary`2"/> 的类型。- 或 -正在分配值,并且 <paramref name="value"/> 属于不能分配给 <paramref name="TValue"/> 的值类型 <see cref="T:System.Collections.Generic.Dictionary`2"/> 的类型。</exception>
[__DynamicallyInvokable]
object IDictionary.this[object key] { [__DynamicallyInvokable] get; [__DynamicallyInvokable] set; }
/// <summary>
/// 枚举 <see cref="T:System.Collections.Generic.Dictionary`2"/> 的元素。
/// </summary>
[__DynamicallyInvokable]
[Serializable]
public struct Enumerator : IEnumerator<KeyValuePair<TKey, TValue>>, IDisposable, IEnumerator, IDictionaryEnumerator
{
/// <summary>
/// 使枚举数前进到 <see cref="T:System.Collections.Generic.Dictionary`2"/> 的下一个元素。
/// </summary>
///
/// <returns>
/// 如果枚举数成功地推进到下一个元素,则为 true;如果枚举数越过集合的结尾,则为 false。
/// </returns>
/// <exception cref="T:System.InvalidOperationException">在创建了枚举数后集合被修改了。</exception>
[__DynamicallyInvokable]
public bool MoveNext();
/// <summary>
/// 释放由 <see cref="T:System.Collections.Generic.Dictionary`2.Enumerator"/> 使用的所有资源。
/// </summary>
[__DynamicallyInvokable]
public void Dispose();
/// <summary>
/// 将枚举数设置为其初始位置,该位置位于集合中第一个元素之前。
/// </summary>
/// <exception cref="T:System.InvalidOperationException">在创建了枚举数后集合被修改了。</exception>
[__DynamicallyInvokable]
void IEnumerator.Reset();
/// <summary>
/// 获取枚举数当前位置的元素。
/// </summary>
///
/// <returns>
/// <see cref="T:System.Collections.Generic.Dictionary`2"/> 中位于枚举数当前位置的元素。
/// </returns>
[__DynamicallyInvokable]
public KeyValuePair<TKey, TValue> Current { [__DynamicallyInvokable] get; }
/// <summary>
/// 获取枚举数当前位置的元素。
/// </summary>
///
/// <returns>
/// 集合中位于枚举数当前位置的元素,如 <see cref="T:System.Object"/>。
/// </returns>
/// <exception cref="T:System.InvalidOperationException">枚举数定位在该集合的第一个元素之前或最后一个元素之后。</exception>
[__DynamicallyInvokable]
object IEnumerator.Current { [__DynamicallyInvokable] get; }
/// <summary>
/// 获取枚举数当前位置的元素。
/// </summary>
///
/// <returns>
/// 字典中位于枚举数当前位置的元素,如 <see cref="T:System.Collections.DictionaryEntry"/>。
/// </returns>
/// <exception cref="T:System.InvalidOperationException">枚举数定位在该集合的第一个元素之前或最后一个元素之后。</exception>
[__DynamicallyInvokable]
DictionaryEntry IDictionaryEnumerator.Entry { [__DynamicallyInvokable] get; }
/// <summary>
/// 获取位于枚举数当前位置的元素的键。
/// </summary>
///
/// <returns>
/// 字典中位于枚举数当前位置的元素的键。
/// </returns>
/// <exception cref="T:System.InvalidOperationException">枚举数定位在该集合的第一个元素之前或最后一个元素之后。</exception>
[__DynamicallyInvokable]
object IDictionaryEnumerator.Key { [__DynamicallyInvokable] get; }
/// <summary>
/// 获取位于枚举数当前位置的元素的值。
/// </summary>
///
/// <returns>
/// 字典中位于枚举数当前位置的元素的值。
/// </returns>
/// <exception cref="T:System.InvalidOperationException">枚举数定位在该集合的第一个元素之前或最后一个元素之后。</exception>
[__DynamicallyInvokable]
object IDictionaryEnumerator.Value { [__DynamicallyInvokable] get; }
}
/// <summary>
/// 表示 <see cref="T:System.Collections.Generic.Dictionary`2"/> 中键的集合。此类不能被继承。
/// </summary>
[DebuggerTypeProxy(typeof (Mscorlib_DictionaryKeyCollectionDebugView<,>))]
[DebuggerDisplay("Count = {Count}")]
[__DynamicallyInvokable]
[Serializable]
public sealed class KeyCollection : ICollection<TKey>, IEnumerable<TKey>, IEnumerable, ICollection, IReadOnlyCollection<TKey>
{
/// <summary>
/// 初始化 <see cref="T:System.Collections.Generic.Dictionary`2.KeyCollection"/> 类的新实例,该实例反映指定的 <see cref="T:System.Collections.Generic.Dictionary`2"/> 中的键。
/// </summary>
/// <param name="dictionary"><see cref="T:System.Collections.Generic.Dictionary`2"/>,其键反映在新的 <see cref="T:System.Collections.Generic.Dictionary`2.KeyCollection"/> 中。</param><exception cref="T:System.ArgumentNullException"><paramref name="dictionary"/> 为 null。</exception>
[__DynamicallyInvokable]
public KeyCollection(Dictionary<TKey, TValue> dictionary);
/// <summary>
/// 返回循环访问 <see cref="T:System.Collections.Generic.Dictionary`2.KeyCollection"/> 的枚举数。
/// </summary>
///
/// <returns>
/// 用于 <see cref="T:System.Collections.Generic.Dictionary`2.KeyCollection"/> 的 <see cref="T:System.Collections.Generic.Dictionary`2.KeyCollection.Enumerator"/>。
/// </returns>
[__DynamicallyInvokable]
public Dictionary<TKey, TValue>.KeyCollection.Enumerator GetEnumerator();
/// <summary>
/// 从指定数组索引开始将 <see cref="T:System.Collections.Generic.Dictionary`2.KeyCollection"/> 元素复制到现有一维 <see cref="T:System.Array"/> 中。
/// </summary>
/// <param name="array">作为从 <see cref="T:System.Collections.Generic.Dictionary`2.KeyCollection"/> 复制的元素的目标位置的一维 <see cref="T:System.Array"/>。<see cref="T:System.Array"/> 必须具有从零开始的索引。</param><param name="index"><paramref name="array"/> 中从零开始的索引,从此索引处开始进行复制。</param><exception cref="T:System.ArgumentNullException"><paramref name="array"/> 为 null。</exception><exception cref="T:System.ArgumentOutOfRangeException"><paramref name="index"/> 小于零。</exception><exception cref="T:System.ArgumentException">源 <see cref="T:System.Collections.Generic.Dictionary`2.KeyCollection"/> 中的元素数目大于从 <paramref name="index"/> 到目标 <paramref name="array"/> 末尾之间的可用空间。</exception>
[__DynamicallyInvokable]
public void CopyTo(TKey[] array, int index);
[__DynamicallyInvokable]
void ICollection<TKey>.Add(TKey item);
[__DynamicallyInvokable]
void ICollection<TKey>.Clear();
[__DynamicallyInvokable]
bool ICollection<TKey>.Contains(TKey item);
[__DynamicallyInvokable]
bool ICollection<TKey>.Remove(TKey item);
[__DynamicallyInvokable]
IEnumerator<TKey> IEnumerable<TKey>.GetEnumerator();
/// <summary>
/// 返回一个循环访问集合的枚举器。
/// </summary>
///
/// <returns>
/// 可用于循环访问集合的 <see cref="T:System.Collections.IEnumerator"/>。
/// </returns>
[__DynamicallyInvokable]
IEnumerator IEnumerable.GetEnumerator();
/// <summary>
/// 从特定的 <see cref="T:System.Array"/> 索引处开始,将 <see cref="T:System.Collections.ICollection"/> 的元素复制到一个 <see cref="T:System.Array"/> 中。
/// </summary>
/// <param name="array">作为从 <see cref="T:System.Collections.ICollection"/> 复制的元素的目标的一维 <see cref="T:System.Array"/>。<see cref="T:System.Array"/> 必须具有从零开始的索引。</param><param name="index"><paramref name="array"/> 中从零开始的索引,从此索引处开始进行复制。</param><exception cref="T:System.ArgumentNullException"><paramref name="array"/> 为 null。</exception><exception cref="T:System.ArgumentOutOfRangeException"><paramref name="index"/> 小于零。</exception><exception cref="T:System.ArgumentException"><paramref name="array"/> 是多维的。- 或 -<paramref name="array"/> 没有从零开始的索引。- 或 -源 <see cref="T:System.Collections.ICollection"/> 中的元素数目大于从 <paramref name="index"/> 到目标 <paramref name="array"/> 末尾之间的可用空间。- 或 -源 <see cref="T:System.Collections.ICollection"/> 的类型无法自动转换为目标 <paramref name="array"/> 的类型。</exception>
[__DynamicallyInvokable]
void ICollection.CopyTo(Array array, int index);
/// <summary>
/// 获取 <see cref="T:System.Collections.Generic.Dictionary`2.KeyCollection"/> 中包含的元素数。
/// </summary>
///
/// <returns>
/// <see cref="T:System.Collections.Generic.Dictionary`2.KeyCollection"/> 中包含的元素个数。检索此属性的值的运算复杂度为 O(1)。
/// </returns>
[__DynamicallyInvokable]
public int Count { [__DynamicallyInvokable] get; }
[__DynamicallyInvokable]
bool ICollection<TKey>.IsReadOnly { [__DynamicallyInvokable] get; }
/// <summary>
/// 获取一个值,该值指示是否同步对 <see cref="T:System.Collections.ICollection"/> 的访问(线程安全)。
/// </summary>
///
/// <returns>
/// 如果对 <see cref="T:System.Collections.ICollection"/> 的访问是同步的(线程安全),则为 true;否则为 false。在 <see cref="T:System.Collections.Generic.Dictionary`2.KeyCollection"/> 的默认实现中,此属性始终返回 false。
/// </returns>
[__DynamicallyInvokable]
bool ICollection.IsSynchronized { [__DynamicallyInvokable] get; }
/// <summary>
/// 获取可用于同步对 <see cref="T:System.Collections.ICollection"/> 的访问的对象。
/// </summary>
///
/// <returns>
/// 可用于同步对 <see cref="T:System.Collections.ICollection"/> 的访问的对象。在 <see cref="T:System.Collections.Generic.Dictionary`2.KeyCollection"/> 的默认实现中,此属性始终返回当前实例。
/// </returns>
[__DynamicallyInvokable]
object ICollection.SyncRoot { [__DynamicallyInvokable] get; }
/// <summary>
/// 枚举 <see cref="T:System.Collections.Generic.Dictionary`2.KeyCollection"/> 的元素。
/// </summary>
[__DynamicallyInvokable]
[Serializable]
public struct Enumerator : IEnumerator<TKey>, IDisposable, IEnumerator
{
/// <summary>
/// 释放由 <see cref="T:System.Collections.Generic.Dictionary`2.KeyCollection.Enumerator"/> 使用的所有资源。
/// </summary>
[__DynamicallyInvokable]
public void Dispose();
/// <summary>
/// 使枚举数前进到 <see cref="T:System.Collections.Generic.Dictionary`2.KeyCollection"/> 的下一个元素。
/// </summary>
///
/// <returns>
/// 如果枚举数已成功地推进到下一个元素,则为 true;如果枚举数传递到集合的末尾,则为 false。
/// </returns>
/// <exception cref="T:System.InvalidOperationException">在创建了枚举数后集合被修改了。</exception>
[__DynamicallyInvokable]
public bool MoveNext();
/// <summary>
/// 将枚举数设置为其初始位置,该位置位于集合中第一个元素之前。
/// </summary>
/// <exception cref="T:System.InvalidOperationException">在创建了枚举数后集合被修改了。</exception>
[__DynamicallyInvokable]
void IEnumerator.Reset();
/// <summary>
/// 获取枚举数当前位置的元素。
/// </summary>
///
/// <returns>
/// <see cref="T:System.Collections.Generic.Dictionary`2.KeyCollection"/> 中位于该枚举数当前位置的元素。
/// </returns>
[__DynamicallyInvokable]
public TKey Current { [__DynamicallyInvokable] get; }
/// <summary>
/// 获取枚举数当前位置的元素。
/// </summary>
///
/// <returns>
/// 集合中位于枚举数当前位置的元素。
/// </returns>
/// <exception cref="T:System.InvalidOperationException">枚举数定位在该集合的第一个元素之前或最后一个元素之后。</exception>
[__DynamicallyInvokable]
object IEnumerator.Current { [__DynamicallyInvokable] get; }
}
}
/// <summary>
/// 表示 <see cref="T:System.Collections.Generic.Dictionary`2"/> 中值的集合。此类不能被继承。
/// </summary>
[DebuggerTypeProxy(typeof (Mscorlib_DictionaryValueCollectionDebugView<,>))]
[DebuggerDisplay("Count = {Count}")]
[__DynamicallyInvokable]
[Serializable]
public sealed class ValueCollection : ICollection<TValue>, IEnumerable<TValue>, IEnumerable, ICollection, IReadOnlyCollection<TValue>
{
/// <summary>
/// 初始化 <see cref="T:System.Collections.Generic.Dictionary`2.ValueCollection"/> 类的新实例,该实例反映指定的 <see cref="T:System.Collections.Generic.Dictionary`2"/> 中的值。
/// </summary>
/// <param name="dictionary"><see cref="T:System.Collections.Generic.Dictionary`2"/>,其值反映在新的 <see cref="T:System.Collections.Generic.Dictionary`2.ValueCollection"/> 中。</param><exception cref="T:System.ArgumentNullException"><paramref name="dictionary"/> 为 null。</exception>
[__DynamicallyInvokable]
public ValueCollection(Dictionary<TKey, TValue> dictionary);
/// <summary>
/// 返回循环访问 <see cref="T:System.Collections.Generic.Dictionary`2.ValueCollection"/> 的枚举数。
/// </summary>
///
/// <returns>
/// 用于 <see cref="T:System.Collections.Generic.Dictionary`2.ValueCollection"/> 的 <see cref="T:System.Collections.Generic.Dictionary`2.ValueCollection.Enumerator"/>。
/// </returns>
[__DynamicallyInvokable]
public Dictionary<TKey, TValue>.ValueCollection.Enumerator GetEnumerator();
/// <summary>
/// 从指定数组索引开始将 <see cref="T:System.Collections.Generic.Dictionary`2.ValueCollection"/> 元素复制到现有一维 <see cref="T:System.Array"/> 中。
/// </summary>
/// <param name="array">作为从 <see cref="T:System.Collections.Generic.Dictionary`2.ValueCollection"/> 复制的元素的目标位置的一维 <see cref="T:System.Array"/>。<see cref="T:System.Array"/> 必须具有从零开始的索引。</param><param name="index"><paramref name="array"/> 中从零开始的索引,从此索引处开始进行复制。</param><exception cref="T:System.ArgumentNullException"><paramref name="array"/> 为 null。</exception><exception cref="T:System.ArgumentOutOfRangeException"><paramref name="index"/> 小于零。</exception><exception cref="T:System.ArgumentException">源 <see cref="T:System.Collections.Generic.Dictionary`2.ValueCollection"/> 中的元素数目大于从 <paramref name="index"/> 到目标 <paramref name="array"/> 末尾之间的可用空间。</exception>
[__DynamicallyInvokable]
public void CopyTo(TValue[] array, int index);
[__DynamicallyInvokable]
void ICollection<TValue>.Add(TValue item);
[__DynamicallyInvokable]
bool ICollection<TValue>.Remove(TValue item);
[__DynamicallyInvokable]
void ICollection<TValue>.Clear();
[__DynamicallyInvokable]
bool ICollection<TValue>.Contains(TValue item);
[__DynamicallyInvokable]
IEnumerator<TValue> IEnumerable<TValue>.GetEnumerator();
/// <summary>
/// 返回一个循环访问集合的枚举器。
/// </summary>
///
/// <returns>
/// 可用于循环访问集合的 <see cref="T:System.Collections.IEnumerator"/>。
/// </returns>
[__DynamicallyInvokable]
IEnumerator IEnumerable.GetEnumerator();
/// <summary>
/// 从特定的 <see cref="T:System.Array"/> 索引处开始,将 <see cref="T:System.Collections.ICollection"/> 的元素复制到一个 <see cref="T:System.Array"/> 中。
/// </summary>
/// <param name="array">作为从 <see cref="T:System.Collections.ICollection"/> 复制的元素的目标的一维 <see cref="T:System.Array"/>。<see cref="T:System.Array"/> 必须具有从零开始的索引。</param><param name="index"><paramref name="array"/> 中从零开始的索引,从此索引处开始进行复制。</param><exception cref="T:System.ArgumentNullException"><paramref name="array"/> 为 null。</exception><exception cref="T:System.ArgumentOutOfRangeException"><paramref name="index"/> 小于零。</exception><exception cref="T:System.ArgumentException"><paramref name="array"/> 是多维的。- 或 -<paramref name="array"/> 没有从零开始的索引。- 或 -源 <see cref="T:System.Collections.ICollection"/> 中的元素数目大于从 <paramref name="index"/> 到目标 <paramref name="array"/> 末尾之间的可用空间。- 或 -源 <see cref="T:System.Collections.ICollection"/> 的类型无法自动转换为目标 <paramref name="array"/> 的类型。</exception>
[__DynamicallyInvokable]
void ICollection.CopyTo(Array array, int index);
/// <summary>
/// 获取 <see cref="T:System.Collections.Generic.Dictionary`2.ValueCollection"/> 中包含的元素数。
/// </summary>
///
/// <returns>
/// <see cref="T:System.Collections.Generic.Dictionary`2.ValueCollection"/> 中包含的元素个数。
/// </returns>
[__DynamicallyInvokable]
public int Count { [__DynamicallyInvokable] get; }
[__DynamicallyInvokable]
bool ICollection<TValue>.IsReadOnly { [__DynamicallyInvokable] get; }
/// <summary>
/// 获取一个值,该值指示是否同步对 <see cref="T:System.Collections.ICollection"/> 的访问(线程安全)。
/// </summary>
///
/// <returns>
/// 如果对 <see cref="T:System.Collections.ICollection"/> 的访问是同步的(线程安全),则为 true;否则为 false。在 <see cref="T:System.Collections.Generic.Dictionary`2.ValueCollection"/> 的默认实现中,此属性始终返回 false。
/// </returns>
[__DynamicallyInvokable]
bool ICollection.IsSynchronized { [__DynamicallyInvokable] get; }
/// <summary>
/// 获取可用于同步对 <see cref="T:System.Collections.ICollection"/> 的访问的对象。
/// </summary>
///
/// <returns>
/// 可用于同步对 <see cref="T:System.Collections.ICollection"/> 的访问的对象。在 <see cref="T:System.Collections.Generic.Dictionary`2.ValueCollection"/> 的默认实现中,此属性始终返回当前实例。
/// </returns>
[__DynamicallyInvokable]
object ICollection.SyncRoot { [__DynamicallyInvokable] get; }
/// <summary>
/// 枚举 <see cref="T:System.Collections.Generic.Dictionary`2.ValueCollection"/> 的元素。
/// </summary>
[__DynamicallyInvokable]
[Serializable]
public struct Enumerator : IEnumerator<TValue>, IDisposable, IEnumerator
{
/// <summary>
/// 释放由 <see cref="T:System.Collections.Generic.Dictionary`2.ValueCollection.Enumerator"/> 使用的所有资源。
/// </summary>
[__DynamicallyInvokable]
public void Dispose();
/// <summary>
/// 使枚举器前进到 <see cref="T:System.Collections.Generic.Dictionary`2.ValueCollection"/> 的下一个元素。
/// </summary>
///
/// <returns>
/// 如果枚举数成功地推进到下一个元素,则为 true;如果枚举数越过集合的结尾,则为 false。
/// </returns>
/// <exception cref="T:System.InvalidOperationException">在创建了枚举数后集合被修改了。</exception>
[__DynamicallyInvokable]
public bool MoveNext();
/// <summary>
/// 将枚举数设置为其初始位置,该位置位于集合中第一个元素之前。
/// </summary>
/// <exception cref="T:System.InvalidOperationException">在创建了枚举数后集合被修改了。</exception>
[__DynamicallyInvokable]
void IEnumerator.Reset();
/// <summary>
/// 获取枚举数当前位置的元素。
/// </summary>
///
/// <returns>
/// <see cref="T:System.Collections.Generic.Dictionary`2.ValueCollection"/> 中位于枚举数当前位置的元素。
/// </returns>
[__DynamicallyInvokable]
public TValue Current { [__DynamicallyInvokable] get; }
/// <summary>
/// 获取枚举数当前位置的元素。
/// </summary>
///
/// <returns>
/// 集合中位于枚举数当前位置的元素。
/// </returns>
/// <exception cref="T:System.InvalidOperationException">枚举数定位在该集合的第一个元素之前或最后一个元素之后。</exception>
[__DynamicallyInvokable]
object IEnumerator.Current { [__DynamicallyInvokable] get; }
}
}
}
}
Dictionary
本文转载:CSDN博客