Filtering out values from a C# Generic Dictionary

后端 未结 6 1983
难免孤独
难免孤独 2020-12-02 16:29

I have a C# dictionary, Dictionary that I need to be filtered based on a property of MyObject.

For example, I want to

6条回答
  •  无人及你
    2020-12-02 16:50

    You can simply use the Linq where clause:

    var filtered = from kvp in myDictionary
                   where !kvp.Value.BooleanProperty
                   select kvp
    

提交回复
热议问题