public double GetCurveThreshold(PointPairList points, double cutoff) { var peptidesThreshPt = points.LastOrDefault(point => point.X < cutoff); return peptidesThreshPt == null ? points.First().Y : peptidesThreshPt.Y; }