/// <summary> /// Fast 'add', using pass by reference, but checking our timepoint is newer than the previous one added /// </summary> /// <param name="p"></param> public void AddPointCheckTime(ref PricePoint p) { // Check we're adding price updates in sequential time // Our assumption is that the price points in our collection are in time order. // We *could* handle out-of-sequence points, inserting them in the correct position (but we don't) if (_points.Any()) { if (_points[_points.Count - 1].Timestamp > p.Timestamp) { throw new Exception("The last price point in the sequence is more recent than the price point to add"); } } AddPoint(ref p); }
/// <summary> /// Fast 'add', using pass by reference (requires a PricePoint already) /// </summary> /// <param name="p"></param> public void AddPoint(ref PricePoint p) { _points.Add(p); }