17 using System.Collections;
18 using System.Collections.Generic;
28 private readonly IDictionary<Symbol, T> _data =
new Dictionary<Symbol, T>();
45 foreach (var datum
in data)
47 this[keySelector(datum)] = datum;
57 #pragma warning disable 618 // This assignment is left here until the Time property is removed.
59 #pragma warning restore 618
65 [Obsolete(
"The DataDictionary<T> Time property is now obsolete. All algorithms should use algorithm.Time instead.")]
66 public DateTime
Time {
get;
set; }
77 return _data.GetEnumerator();
86 IEnumerator IEnumerable.GetEnumerator()
88 return ((IEnumerable)_data).GetEnumerator();
95 public void Add(KeyValuePair<Symbol, T> item)
118 return _data.Contains(item);
125 public void CopyTo(KeyValuePair<Symbol, T>[] array,
int arrayIndex)
127 _data.CopyTo(array, arrayIndex);
137 public bool Remove(KeyValuePair<Symbol, T> item)
139 return _data.Remove(item);
150 get {
return _data.Count; }
161 get {
return _data.IsReadOnly; }
173 return _data.ContainsKey(key);
182 _data.Add(key, value);
194 return _data.Remove(key);
206 return _data.TryGetValue(key, out value);
219 public override T
this[
Symbol symbol]
228 throw new KeyNotFoundException($
"'{symbol}' wasn't found in the {GetType().GetBetterTypeName()} object, likely because there was no-data at this moment in time and it wasn't possible to fillforward historical data. Please check the data exists before accessing it with data.ContainsKey(\"{symbol}\")");
232 _data[symbol] = value;
242 public ICollection<Symbol>
Keys
244 get {
return _data.Keys; }
253 public ICollection<T>
Values
255 get {
return _data.Values; }
300 dictionary.Add(data.Symbol, data);