using System.Collections; using System.Collections.Generic; using System.Text; using System; namespace Rokojori { public class Dictionaries { public static void RemoveAll( Dictionary dictionary, Func predicate ) { var list = new List(); foreach ( var kv in dictionary ) { if ( predicate( kv.Key, kv.Value ) ) { list.Add( kv.Key ); } } list.ForEach( k => dictionary.Remove( k ) ); } } }