Dictionary字典1

#region 程序集 mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\mscorlib.dll
#endregion

using System.Diagnostics;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Security;

namespace System.Collections.Generic
{
//
// 摘要:
// 表示键和值的集合。
//
// 类型参数:
// TKey:
// 字典中的键的类型。
//
// TValue:
// 字典中的值的类型。
[ComVisible(false)]
[DebuggerDisplay("Count = {Count}")]
[DebuggerTypeProxy(typeof(Generic.Mscorlib_DictionaryDebugView<,>))]
[DefaultMember("Item")]
public class Dictionary<TKey, TValue> : IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IDictionary, ICollection, IReadOnlyDictionary<TKey, TValue>, IReadOnlyCollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable, ISerializable, IDeserializationCallback
{
//
// 摘要:
// 初始化 System.Collections.Generic.Dictionary`2 类的新实例,该实例为空且具有默认的初始容量,并使用键类型的默认相等比较器。
public Dictionary();
//
// 摘要:
// 初始化 System.Collections.Generic.Dictionary`2 类的新实例,该实例为空且具有指定的初始容量,并为键类型使用默认的相等比较器。
//
// 参数:
// capacity:
// System.Collections.Generic.Dictionary`2 可包含的初始元素数。
//
// 异常:
// T:System.ArgumentOutOfRangeException:
// capacity 小于 0。
public Dictionary(int capacity);
//
// 摘要:
// 初始化 System.Collections.Generic.Dictionary`2 类的新实例,该实例为空且具有默认的初始容量,并使用指定的 System.Collections.Generic.IEqualityComparer`1。
//
// 参数:
// comparer:
// 比较键时要使用的 System.Collections.Generic.IEqualityComparer`1 实现,或者为 null,以便为键类型使用默认的
// System.Collections.Generic.EqualityComparer`1。
public Dictionary(IEqualityComparer<TKey> comparer);
//
// 摘要:
// 初始化 System.Collections.Generic.Dictionary`2 类的新实例,该实例包含从指定的 System.Collections.Generic.IDictionary`2
// 中复制的元素并为键类型使用默认的相等比较器。
//
// 参数:
// dictionary:
// System.Collections.Generic.IDictionary`2,它的元素被复制到新的 System.Collections.Generic.Dictionary`2
// 中。
//
// 异常:
// T:System.ArgumentNullException:
// dictionary 为 null。
//
// T:System.ArgumentException:
// dictionary 包含一个或多个重复键。
public Dictionary(IDictionary<TKey, TValue> dictionary);
//
// 摘要:
// 初始化 System.Collections.Generic.Dictionary`2 类的新实例,该实例为空且具有指定的初始容量,并使用指定的 System.Collections.Generic.IEqualityComparer`1。
//
// 参数:
// capacity:
// System.Collections.Generic.Dictionary`2 可包含的初始元素数。
//
// comparer:
// 比较键时要使用的 System.Collections.Generic.IEqualityComparer`1 实现,或者为 null,以便为键类型使用默认的
// System.Collections.Generic.EqualityComparer`1。
//
// 异常:
// T:System.ArgumentOutOfRangeException:
// capacity 小于 0。
public Dictionary(int capacity, IEqualityComparer<TKey> comparer);
//
// 摘要:
// 初始化 System.Collections.Generic.Dictionary`2 类的新实例,该实例包含从指定的 System.Collections.Generic.IDictionary`2
// 中复制的元素并使用指定的 System.Collections.Generic.IEqualityComparer`1。
//
// 参数:
// dictionary:
// System.Collections.Generic.IDictionary`2,它的元素被复制到新的 System.Collections.Generic.Dictionary`2
// 中。
//
// comparer:
// 比较键时要使用的 System.Collections.Generic.IEqualityComparer`1 实现,或者为 null,以便为键类型使用默认的
// System.Collections.Generic.EqualityComparer`1。
//
// 异常:
// T:System.ArgumentNullException:
// dictionary 为 null。
//
// T:System.ArgumentException:
// dictionary 包含一个或多个重复键。
public Dictionary(IDictionary<TKey, TValue> dictionary, IEqualityComparer<TKey> comparer);
//
// 摘要:
// 用序列化数据初始化 System.Collections.Generic.Dictionary`2 类的新实例。
//
// 参数:
// info:
// 一个 System.Runtime.Serialization.SerializationInfo 对象,它包含序列化 System.Collections.Generic.Dictionary`2
// 所需的信息。
//
// context:
// System.Runtime.Serialization.StreamingContext 结构,该结构包含与 System.Collections.Generic.Dictionary`2
// 相关联的序列化流的源和目标。
protected Dictionary(SerializationInfo info, StreamingContext context);

//
// 摘要:
// 获取或设置与指定的键相关联的值。
//
// 参数:
// key:
// 要获取或设置的值的键。
//
// 返回结果:
// 与指定的键相关联的值。如果找不到指定的键,get 操作便会引发 System.Collections.Generic.KeyNotFoundException,而
// set 操作会创建一个具有指定键的新元素。
//
// 异常:
// T:System.ArgumentNullException:
// key 为 null。
//
// T:System.Collections.Generic.KeyNotFoundException:
// 已检索该属性,并且集合中不存在 key。
public TValue this[TKey key] { get; set; }

//
// 摘要:
// 获取用于确定字典中的键是否相等的 System.Collections.Generic.IEqualityComparer`1。
//
// 返回结果:
// 用于确定当前 System.Collections.Generic.Dictionary`2 中的键是否相等并为键提供哈希值的 System.Collections.Generic.IEqualityComparer`1
// 泛型接口实现。
public IEqualityComparer<TKey> Comparer { get; }
//
// 摘要:
// 获取包含在 System.Collections.Generic.Dictionary`2 中的键/值对的数目。
//
// 返回结果:
// 包含在 System.Collections.Generic.Dictionary`2 中的键/值对的数目。
public int Count { get; }
//
// 摘要:
// 获取包含 System.Collections.Generic.Dictionary`2 中的键的集合。
//
// 返回结果:
// 包含 System.Collections.Generic.Dictionary`2 中的键的 System.Collections.Generic.Dictionary`2.KeyCollection。
public KeyCollection Keys { get; }
//
// 摘要:
// 获取包含 System.Collections.Generic.Dictionary`2 中的值的集合。
//
// 返回结果:
// 包含 System.Collections.Generic.Dictionary`2 中的值的 System.Collections.Generic.Dictionary`2.ValueCollection。
public ValueCollection Values { get; }

//
// 摘要:
// 将指定的键和值添加到字典中。
//
// 参数:
// key:
// 要添加的元素的键。
//
// value:
// 要添加的元素的值。对于引用类型,该值可以为 null。
//
// 异常:
// T:System.ArgumentNullException:
// key 为 null。
//
// T:System.ArgumentException:
// System.Collections.Generic.Dictionary`2 中已存在具有相同键的元素。
public void Add(TKey key, TValue value);
//
// 摘要:
// 从 System.Collections.Generic.Dictionary`2 中移除所有的键和值。
public void Clear();
//
// 摘要:
// 确定 System.Collections.Generic.Dictionary`2 是否包含指定的键。
//
// 参数:
// key:
// 要在 System.Collections.Generic.Dictionary`2 中定位的键。
//
// 返回结果:
// 如果 System.Collections.Generic.Dictionary`2 包含具有指定键的元素,则为 true;否则为 false。
//
// 异常:
// T:System.ArgumentNullException:
// key 为 null。
public bool ContainsKey(TKey key);
//
// 摘要:
// 确定 System.Collections.Generic.Dictionary`2 是否包含特定值。
//
// 参数:
// value:
// 要在 System.Collections.Generic.Dictionary`2 中定位的值。对于引用类型,该值可以为 null。
//
// 返回结果:
// 如果 System.Collections.Generic.Dictionary`2 包含具有指定值的元素,则为 true;否则为 false。
public bool ContainsValue(TValue value);
//
// 摘要:
// 返回循环访问 System.Collections.Generic.Dictionary`2 的枚举数。
//
// 返回结果:
// 用于 System.Collections.Generic.Dictionary`2 的 System.Collections.Generic.Dictionary`2.Enumerator
// 结构。
public Enumerator GetEnumerator();
//
// 摘要:
// 实现 System.Runtime.Serialization.ISerializable 接口,并返回序列化 System.Collections.Generic.Dictionary`2
// 实例所需的数据。
//
// 参数:
// info:
// System.Runtime.Serialization.SerializationInfo 对象,该对象包含序列化 System.Collections.Generic.Dictionary`2
// 实例所需的信息。
//
// context:
// System.Runtime.Serialization.StreamingContext 结构,该结构包含与 System.Collections.Generic.Dictionary`2
// 实例相关联的序列化流的源和目标。
//
// 异常:
// T:System.ArgumentNullException:
// info 为 null。
[SecurityCritical]
public virtual void GetObjectData(SerializationInfo info, StreamingContext context);
//
// 摘要:
// 实现 System.Runtime.Serialization.ISerializable 接口,并在完成反序列化之后引发反序列化事件。
//
// 参数:
// sender:
// 反序列化事件源。
//
// 异常:
// T:System.Runtime.Serialization.SerializationException:
// 与当前 System.Collections.Generic.Dictionary`2 实例关联的 System.Runtime.Serialization.SerializationInfo
// 对象无效。
public virtual void OnDeserialization(object sender);
//
// 摘要:
// 从 System.Collections.Generic.Dictionary`2 中移除所指定的键的值。
//
// 参数:
// key:
// 要移除的元素的键。
//
// 返回结果:
// 如果成功找到并移除该元素,则为 true;否则为 false。如果在 System.Collections.Generic.Dictionary`2 中没有找到
// key,此方法则返回 false。
//
// 异常:
// T:System.ArgumentNullException:
// key 为 null。
public bool Remove(TKey key);
//
// 摘要:
// 获取与指定的键相关联的值。
//
// 参数:
// key:
// 要获取的值的键。
//
// value:
// 当此方法返回值时,如果找到该键,便会返回与指定的键相关联的值;否则,则会返回 value 参数的类型默认值。该参数未经初始化即被传递。
//
// 返回结果:
// 如果 System.Collections.Generic.Dictionary`2 包含具有指定键的元素,则为 true;否则为 false。
//
// 异常:
// T:System.ArgumentNullException:
// key 为 null。
public bool TryGetValue(TKey key, out TValue value);

//
// 摘要:
// 枚举 System.Collections.Generic.Dictionary`2 的元素。
public struct Enumerator : IEnumerator<KeyValuePair<TKey, TValue>>, IDisposable, IDictionaryEnumerator, IEnumerator
{
//
// 摘要:
// 获取枚举数当前位置的元素。
//
// 返回结果:
// System.Collections.Generic.Dictionary`2 中位于枚举数当前位置的元素。
public KeyValuePair<TKey, TValue> Current { get; }

//
// 摘要:
// 释放由 System.Collections.Generic.Dictionary`2.Enumerator 使用的所有资源。
public void Dispose();
//
// 摘要:
// 使枚举数前进到 System.Collections.Generic.Dictionary`2 的下一个元素。
//
// 返回结果:
// 如果枚举数成功地推进到下一个元素,则为 true;如果枚举数越过集合的结尾,则为 false。
//
// 异常:
// T:System.InvalidOperationException:
// 在创建了枚举数后集合被修改了。
public bool MoveNext();
}

//
// 摘要:
// 表示 System.Collections.Generic.Dictionary`2 中键的集合。此类不能被继承。
[DebuggerDisplay("Count = {Count}")]
[DebuggerTypeProxy(typeof(Generic.Mscorlib_DictionaryKeyCollectionDebugView<,>))]
public sealed class KeyCollection : ICollection<TKey>, IEnumerable<TKey>, ICollection, IEnumerable
{
//
// 摘要:
// 初始化 System.Collections.Generic.Dictionary`2.KeyCollection 类的新实例,该实例反映指定的 System.Collections.Generic.Dictionary`2
// 中的键。
//
// 参数:
// dictionary:
// System.Collections.Generic.Dictionary`2,其键反映在新的 System.Collections.Generic.Dictionary`2.KeyCollection
// 中。
//
// 异常:
// T:System.ArgumentNullException:
// dictionary 为 null。
public KeyCollection(Dictionary<TKey, TValue> dictionary);

//
// 摘要:
// 获取 System.Collections.Generic.Dictionary`2.KeyCollection 中包含的元素数。
//
// 返回结果:
// System.Collections.Generic.Dictionary`2.KeyCollection 中包含的元素个数。检索此属性的值的运算复杂度为
// O(1)。
public int Count { get; }

//
// 摘要:
// 从指定数组索引开始将 System.Collections.Generic.Dictionary`2.KeyCollection 元素复制到现有一维 System.Array
// 中。
//
// 参数:
// array:
// 作为从 System.Collections.Generic.Dictionary`2.KeyCollection 复制的元素的目标位置的一维 System.Array。System.Array
// 必须具有从零开始的索引。
//
// index:
// array 中从零开始的索引,从此索引处开始进行复制。
//
// 异常:
// T:System.ArgumentNullException:
// array 为 null。
//
// T:System.ArgumentOutOfRangeException:
// index 小于零。
//
// T:System.ArgumentException:
// 源 System.Collections.Generic.Dictionary`2.KeyCollection 中的元素数目大于从 index 到目标 array
// 末尾之间的可用空间。
public void CopyTo(TKey[] array, int index);
//
// 摘要:
// 返回循环访问 System.Collections.Generic.Dictionary`2.KeyCollection 的枚举数。
//
// 返回结果:
// 用于 System.Collections.Generic.Dictionary`2.KeyCollection 的 System.Collections.Generic.Dictionary`2.KeyCollection.Enumerator。
public Enumerator GetEnumerator();

//
// 摘要:
// 枚举 System.Collections.Generic.Dictionary`2.KeyCollection 的元素。
public struct Enumerator : IEnumerator<TKey>, IDisposable, IEnumerator
{
//
// 摘要:
// 获取枚举数当前位置的元素。
//
// 返回结果:
// System.Collections.Generic.Dictionary`2.KeyCollection 中位于枚举数当前位置的元素。
public TKey Current { get; }

//
// 摘要:
// 释放由 System.Collections.Generic.Dictionary`2.KeyCollection.Enumerator 使用的所有资源。
public void Dispose();
//
// 摘要:
// 使枚举数前进到 System.Collections.Generic.Dictionary`2.KeyCollection 的下一个元素。
//
// 返回结果:
// 如果枚举数成功地推进到下一个元素,则为 true;如果枚举数越过集合的结尾,则为 false。
//
// 异常:
// T:System.InvalidOperationException:
// 在创建了枚举数后集合被修改了。
public bool MoveNext();
}
}
//
// 摘要:
// 表示 System.Collections.Generic.Dictionary`2 中值的集合。此类不能被继承。
[DebuggerDisplay("Count = {Count}")]
[DebuggerTypeProxy(typeof(Generic.Mscorlib_DictionaryValueCollectionDebugView<,>))]
public sealed class ValueCollection : ICollection<TValue>, IEnumerable<TValue>, ICollection, IEnumerable
{
//
// 摘要:
// 初始化 System.Collections.Generic.Dictionary`2.ValueCollection 类的新实例,该实例反映指定的 System.Collections.Generic.Dictionary`2
// 中的值。
//
// 参数:
// dictionary:
// System.Collections.Generic.Dictionary`2,其值反映在新的 System.Collections.Generic.Dictionary`2.ValueCollection
// 中。
//
// 异常:
// T:System.ArgumentNullException:
// dictionary 为 null。
public ValueCollection(Dictionary<TKey, TValue> dictionary);

//
// 摘要:
// 获取 System.Collections.Generic.Dictionary`2.ValueCollection 中包含的元素数。
//
// 返回结果:
// System.Collections.Generic.Dictionary`2.ValueCollection 中包含的元素个数。
public int Count { get; }

//
// 摘要:
// 从指定数组索引开始将 System.Collections.Generic.Dictionary`2.ValueCollection 元素复制到现有一维
// System.Array 中。
//
// 参数:
// array:
// 作为从 System.Collections.Generic.Dictionary`2.ValueCollection 复制的元素的目标位置的一维 System.Array。System.Array
// 必须具有从零开始的索引。
//
// index:
// array 中从零开始的索引,从此索引处开始进行复制。
//
// 异常:
// T:System.ArgumentNullException:
// array 为 null。
//
// T:System.ArgumentOutOfRangeException:
// index 小于零。
//
// T:System.ArgumentException:
// 源 System.Collections.Generic.Dictionary`2.ValueCollection 中的元素数目大于从 index 到目标
// array 末尾之间的可用空间。
public void CopyTo(TValue[] array, int index);
//
// 摘要:
// 返回循环访问 System.Collections.Generic.Dictionary`2.ValueCollection 的枚举数。
//
// 返回结果:
// 用于 System.Collections.Generic.Dictionary`2.ValueCollection 的 System.Collections.Generic.Dictionary`2.ValueCollection.Enumerator。
public Enumerator GetEnumerator();

//
// 摘要:
// 枚举 System.Collections.Generic.Dictionary`2.ValueCollection 的元素。
public struct Enumerator : IEnumerator<TValue>, IDisposable, IEnumerator
{
//
// 摘要:
// 获取枚举数当前位置的元素。
//
// 返回结果:
// System.Collections.Generic.Dictionary`2.ValueCollection 中位于枚举数当前位置的元素。
public TValue Current { get; }

//
// 摘要:
// 释放由 System.Collections.Generic.Dictionary`2.ValueCollection.Enumerator 使用的所有资源。
public void Dispose();
//
// 摘要:
// 使枚举数前进到 System.Collections.Generic.Dictionary`2.ValueCollection 的下一个元素。
//
// 返回结果:
// 如果枚举数成功地推进到下一个元素,则为 true;如果枚举数越过集合的结尾,则为 false。
//
// 异常:
// T:System.InvalidOperationException:
// 在创建了枚举数后集合被修改了。
public bool MoveNext();
}
}
}
}

posted @ 2018-11-22 16:07  十七岁的天空  阅读(312)  评论(0编辑  收藏  举报