StringDictionary VS字典&LT;字符串,字符串&GT; [英] StringDictionary vs Dictionary<string, string>
问题描述
有没有人有任何想法的实际差别是System.Collections.Specialized.StringDictionary对象System.Collections.Generic.Dictionary?
Does anyone have any idea what the practical differences are between the System.Collections.Specialized.StringDictionary object and System.Collections.Generic.Dictionary?
我已经在过去使用他们俩没有过多考虑哪个会表现得更好,更好地与LINQ的工作,或提供任何其他好处。
I've used them both in the past without much thought as to which would perform better, work better with Linq, or provide any other benefits.
任何想法或建议,为什么我应该用一个比其他?
Any thoughts or suggestions as to why I should use one over the other?
推荐答案
词典&LT;字符串,字符串&GT;
是一个更现代的方法。它实现了的IEnumerable&LT; T&GT;
键,它更适合LINQy的东西。
Dictionary<string, string>
is a more modern approach. It implements IEnumerable<T>
and it's more suited for LINQy stuff.
StringDictionary
是老派的方式。这是有前泛型天。只有当与传统的code接口,我会用它。
StringDictionary
is the old school way. It was there before generics days. I would use it only when interfacing with legacy code.
这篇关于StringDictionary VS字典&LT;字符串,字符串&GT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!