Properties is one of the source-code metrics Understand computes across 17+ languages — browse them in the GUI, export and track them, or script them with the Python API.
Properties
API ID: CountDeclPropertyLanguages: C#, Pascal
Targets: Architectures, Classes, Project
Number of properties.
Counts every property regardless of how its accessors are implemented — both auto-implemented properties and ones with an explicit backing field and accessor bodies.
For example:
namespace MetricsDemo
{
public class PropertyDemo
{
public int X { get; set; }
private int y;
public int Y
{
get { return y; }
set { y = value; }
}
}
}
Both X (auto-implemented) and Y (explicit backing field y, with hand-written get/set bodies) count, giving CountDeclProperty = 2.
See Auto-Implemented Properties for just the auto-implemented subset. Properties aren't C#-only — Object Pascal's property Name: Type read Getter write Setter; syntax counts here too.
- C#: Project, Class, Struct
- Pascal: Project, Class, Interface
- For projects and architectures, this metric must also be enabled from "Project Configuration/Metrics/Projects and Architectures" with the "Show aggregated class metrics" option. Enabling this option can be time consuming.
- This metric can be disabled from "Project Configuration/Metrics/Object Orientated" with the "Show method and variable count metrics" option.