Case insensitive access for generic dictionary

前端 未结 4 654
梦毁少年i
梦毁少年i 2020-11-28 02:31

I have an application that use managed dlls. One of those dlls return a generic dictionary:

Dictionary MyDictionary;  

4条回答
  •  庸人自扰
    2020-11-28 03:16

    For you LINQers out there who never use a regular dictionary constructor:

    myCollection.ToDictionary(x => x.PartNumber, x => x.PartDescription, StringComparer.OrdinalIgnoreCase)
    

提交回复
热议问题