public Dictionary <T, U> DictionaryWithKeys <T, U>(IEnumerable <T> keys, IInstanceGenerator instanceGenerator) { var dict = Dictionary <T, U>(0, instanceGenerator); foreach (var key in keys) { dict.Add(key, instanceGenerator.InstanceOf <U>()); } return(dict); }