开发者

Is there a difference between StringDictionary class and Dictionary<String,String> [duplicate]

This question already has answers here: StringDictionary vs Dictionary<string, string> (7 answers) Closed 9 years ago.

System.Collections.Specialized contains String开发者_JAVA百科Dictionary http://msdn.microsoft.com/en-us/library/system.collections.specialized.stringdictionary.aspx#Y1626

What's difference with Strong Typed Dictionary in Generics?


StringDictionary comes from .Net 1, which predates generics.

Therefore, unlike Dictionary<String, String>, it doesn't implement any generic interfaces, so it cannot be used with LINQ (unless you Cast())

Also, StringDictionary normalizes all keys to lowercase.
(To make a case-insensitive Dictionary<String, String>, pass StringComparer.OrdinalIgnoreCase; this is also more compatible with Turkey)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜