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

Microsoft.ApplicationInsights.Metrics.MetricsCollection

A collection of metrics available at a specific scope. A metric is itself a colection of data time series identified by dimension name-values.
public int Count { get; }

Gets the number of metrics in this collection.

public bool IsReadOnly { get; }

Gets a value indicating whether this collection is read-only. It is not.

public void Clear()

Removes all metrics from this collection.

public bool Contains(Metric metric)

Checks if a metric is present in this collection.

public bool Contains(MetricIdentifier metricIdentifier)

Checks if a metric with th specified identity is present in this collection.

public void CopyTo(Metric[] array, int arrayIndex)

Copies the contents of this collection to the specified array.

Gets an enumerator for this collection.

public Metric GetOrCreate(MetricIdentifier metricIdentifier, MetricConfiguration metricConfiguration)

Gets the specified metric, or creates one if no such metric exists.

public bool Remove(Metric metric)

Removes the specified metric from this collection.

public bool Remove(MetricIdentifier metricIdentifier)

Removes a metric with the specified identity from this collection.

public bool Remove(MetricIdentifier metricIdentifier, out Metric removedMetric)

Removes a metric with the specified identity from this collection.

public bool TryGet(MetricIdentifier metricIdentifier, out Metric metric)

Gets the metric with the specified identify, if it exists.