///<summary>Creates an anonymous dictionary with a fixed number of keys mapped by a value getter.</summary> public AnonymousReadOnlyDictionary(int count, IEnumerable <TKey> keys, TryGetter <TKey, TValue> getter) : this(() => count, keys, getter) { if (count < 0) { throw new ArgumentOutOfRangeException("count", "count < 0"); } }
///<summary>Creates an anonymous dictionary based on a counter, keys, and a getter.</summary> public AnonymousReadOnlyDictionary(Func <int> counter, IEnumerable <TKey> keys, TryGetter <TKey, TValue> getter) { if (counter == null) { throw new ArgumentNullException("counter"); } if (keys == null) { throw new ArgumentNullException("keys"); } if (getter == null) { throw new ArgumentNullException("getter"); } _counter = counter; _keys = keys; _getter = getter; }
///<summary>Creates an anonymous dictionary with a collection of keys mapped by a value getter.</summary> public AnonymousReadOnlyDictionary(IReadOnlyCollection <TKey> keys, TryGetter <TKey, TValue> getter) : this(() => keys.Count, keys, getter) { }