<PackageReference Include="Microsoft.ApplicationInsights" Version="2.22.0" />

Microsoft.ApplicationInsights.Metrics.MetricAggregate

public class MetricAggregate
Holds the metric aggregation results of a particular metric data series over an aggregation time period. The specific data fields on instanced of this class are not strongly typed (property bag) which allows using this aggregate type for aggregates of any aggregation kind.
public string AggregationKindMoniker { get; }

Gets the moniker defining the kind of the aggregation used for the respective metric.

public TimeSpan AggregationPeriodDuration { get; set; }

Gets or sets the length of the aggregation period summarized by this aggregate.

Gets or sets the start of the aggregation period summarized by this aggregate.

public IDictionary<string, object> Data { get; }

Gets the property bag that contains the actual aggregate data. For example, if the aggregate was produced for a metric of the aggregation kind Measurement, the look-up key for this property bag are accessible via AggregateKindDataKeys.

public IDictionary<string, string> Dimensions { get; }

Gets get table of dimension name-values that specify the data series that produced this agregate within the overall metric.

public string MetricId { get; }

Gets the id (name) of the metric that produced this aggregate.

public string MetricNamespace { get; }

Gets the namespace of the metric that produces this aggregate.

public MetricAggregate(string metricNamespace, string metricId, string aggregationKindMoniker)

Ceates a new metric aggregate.

public T GetDataValue<T>(string dataKey, T defaultValue)

This is a convenience method to retrieve the object at Data[dataKey]. It attempts to convert that object to the specified type T. If the conversion fails, the specified defaultValue is returned.