public T this[DateTime idx] { get { if (!Data.ContainsKey(idx)) { Data.Add(idx, default(T)); DataDescending.Add(idx, default(T)); } return(Data[idx]); } set { if (!Data.ContainsKey(idx)) { Data.Add(idx, default(T)); DataDescending.Add(idx, default(T)); } Data[idx] = value; DataDescending[idx] = value; } }
public void Dispose() { Data.Clear(); DataDescending.Clear(); }
public void Add(DateTime key, T value) { Data.Add(key, value); DataDescending.Add(key, value); }
/// <summary> /// Return a number of historic data points from a point in time backwards indexed by time /// </summary> /// <param name="dateTime">The start time at which the data range should start from</param> /// <param name="count">The number of data points into the past</param> /// <returns>The values indexed by their times of the data points found</returns> public IEnumerable <KeyValuePair <DateTime, T> > GetPreviousData(DateTime dateTime, int count) { var rv = DataDescending.Where(i => i.Key <= dateTime).Take(count); return(rv); }