I have a C# dictionary, Dictionary<Guid, MyObject> that I need to be filtered based on a property of MyObject.
For example, I want to remove all records from the dictionary where MyObject.BooleanProperty = false. What is the best way of acheiving this?
Since Dictionary implements
IEnumerable<KeyValuePair<Key, Value>>, you can just useWhere:To recreate a new dictionary if you need it, use the
ToDictionarymethod.