Exemplo n.º 1
0
        /// <summary>
        /// Gets the time series values for the requested sampling type.
        /// </summary>
        /// <param name="samplingType">The sampling type requested.</param>
        /// <returns>The array of datapoints for the requested sampling type/</returns>
        /// <exception cref="System.Collections.Generic.KeyNotFoundException">Thrown if the sampling type was not included in the response.</exception>
        /// <remarks>
        /// double.NaN is the sentinel used to indicate there is no metric value.
        /// </remarks>
        public double[] GetTimeSeriesValues(SamplingType samplingType)
        {
            for (var i = 0; i < this.TimeSeriesValues.Count; ++i)
            {
                if (samplingType.Equals(this.TimeSeriesValues[i].Key))
                {
                    return(this.TimeSeriesValues[i].Value);
                }
            }

            throw new KeyNotFoundException($"Sampling type {samplingType} not found in the query result.");
        }