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 public DateTime
Time {
get;
set; }
76 return _data.GetEnumerator();
85 IEnumerator IEnumerable.GetEnumerator()
87 return ((IEnumerable)_data).GetEnumerator();
94 public void Add(KeyValuePair<Symbol, T> item)
117 return _data.Contains(item);
124 public void CopyTo(KeyValuePair<Symbol, T>[] array,
int arrayIndex)
126 _data.CopyTo(array, arrayIndex);
136 public bool Remove(KeyValuePair<Symbol, T> item)
138 return _data.Remove(item);
149 get {
return _data.Count; }
160 get {
return _data.IsReadOnly; }
172 return _data.ContainsKey(key);
181 _data.Add(key, value);
193 return _data.Remove(key);
205 return _data.TryGetValue(key, out value);
218 public override T
this[
Symbol symbol]
227 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}\")");
231 _data[symbol] = value;
241 public ICollection<Symbol>
Keys
243 get {
return _data.Keys; }
252 public ICollection<T>
Values
254 get {
return _data.Values; }
299 dictionary.Add(data.Symbol, data);