NetBlog主题

C# Lookup类 Lookup<TKey, TSource>与 Dictionary<TKey, TSource>区别
C#基础

C# Lookup类 Lookup<TKey, TSource>与 Dictionary<TKey, TSource>区别

3623

Dictionary<TKey, TValue>只为每个键支持一个值。新类Lookup<TKey, TElement>是.NET 3.5中新增的,它类似于Dictionary<TKey, TValue>,但把键映射到一个值集上。这个类在程序集System.Core中实现,用System.Linq命名空间定义 Lookup<TKey, TElement>不…