Beispiel #1
0
        /// <summary>
        /// Add two specified <see cref="QueryMetrics"/> instances
        /// </summary>
        /// <param name="queryMetrics1">The first <see cref="QueryMetrics"/> instance</param>
        /// <param name="queryMetrics2">The second <see cref="QueryMetrics"/> instance</param>
        /// <returns>A new <see cref="QueryMetrics"/> instance that is the sum of two <see cref="QueryMetrics"/> instances</returns>
        public static QueryMetrics operator +(QueryMetrics queryMetrics1, QueryMetrics queryMetrics2)
        {
            QueryMetrics.Accumulator queryMetricsAccumulator = new QueryMetrics.Accumulator();
            queryMetricsAccumulator = queryMetricsAccumulator.Accumulate(queryMetrics1);
            queryMetricsAccumulator = queryMetricsAccumulator.Accumulate(queryMetrics2);

            return(QueryMetrics.Accumulator.ToQueryMetrics(queryMetricsAccumulator));
        }
Beispiel #2
0
        public static QueryMetrics CreateFromIEnumerable(IEnumerable <QueryMetrics> queryMetricsList)
        {
            if (queryMetricsList == null)
            {
                throw new ArgumentNullException(nameof(queryMetricsList));
            }

            QueryMetrics.Accumulator queryMetricsAccumulator = new QueryMetrics.Accumulator();
            foreach (QueryMetrics queryMetrics in queryMetricsList)
            {
                queryMetricsAccumulator = queryMetricsAccumulator.Accumulate(queryMetrics);
            }

            return(QueryMetrics.Accumulator.ToQueryMetrics(queryMetricsAccumulator));
        }