Open sandboxFocus

Method GetMetric

GetMetric(IMeasurable)

Gets the metric for a measurable code element.

Declaration
public T GetMetric(IMeasurable measurable)
Parameters
Type Name Description
IMeasurable measurable

The code element to measure (type, member, namespace, or compilation).

Returns
Type Description
T

The computed metric value.

Implements
Remarks

This method dispatches to the appropriate compute method based on the target type: ComputeMetricForType(INamedType) for types, ComputeMetricForMember(IMember) for members, and aggregates results for namespaces and compilations.

Exceptions
Type Condition
InvalidOperationException

The metric cannot be computed for the given target type.