18 using System.Collections;
19 using System.Collections.Generic;
30 private readonly IDictionary<Symbol, T> _data =
new Dictionary<Symbol, T>();
47 foreach (var datum
in data)
49 this[keySelector(datum)] = datum;
59 #pragma warning disable 618 // This assignment is left here until the Time property is removed.
61 #pragma warning restore 618
67 public DateTime
Time {
get;
set; }
78 return _data.GetEnumerator();
87 IEnumerator IEnumerable.GetEnumerator()
89 return ((IEnumerable)_data).GetEnumerator();
96 public void Add(KeyValuePair<Symbol, T> item)
119 return _data.Contains(item);
126 public void CopyTo(KeyValuePair<Symbol, T>[] array,
int arrayIndex)
128 _data.CopyTo(array, arrayIndex);
138 public bool Remove(KeyValuePair<Symbol, T> item)
140 return _data.Remove(item);
151 get {
return _data.Count; }
162 get {
return _data.IsReadOnly; }
174 return _data.ContainsKey(key);
183 _data.Add(key, value);
195 return _data.Remove(key);
207 return _data.TryGetValue(key, out value);
220 public override T
this[
Symbol symbol]
229 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}\")");
233 _data[symbol] = value;
243 public ICollection<Symbol>
Keys
245 get {
return _data.Keys; }
254 public ICollection<T>
Values
256 get {
return _data.Values; }
301 dictionary.Add(data.Symbol, data);