Beispiel #1
0
        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;
            }
        }
Beispiel #2
0
 public void Dispose()
 {
     Data.Clear();
     DataDescending.Clear();
 }
Beispiel #3
0
 public void Add(DateTime key, T value)
 {
     Data.Add(key, value);
     DataDescending.Add(key, value);
 }
Beispiel #4
0
        /// <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);
        }