scitools.com

← Metric catalog

Auto-Implemented 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.

Auto-Implemented Properties

API ID: CountDeclPropertyAuto
Languages: C#
Targets: Architectures, Classes, Project

Number of auto-implemented properties.

An auto-implemented property (C#'s { get; set; } shorthand) has its backing field generated automatically by the compiler, rather than declared and managed explicitly.

For example:


namespace MetricsDemo
{
    public class PropertyDemo
    {
        public int X { get; set; }

        private int y;
        public int Y
        {
            get { return y; }
            set { y = value; }
        }
    }
}

X is auto-implemented, giving CountDeclPropertyAuto = 1. Y has an explicit backing field (y) and hand-written accessor bodies, so it doesn't count here even though it's still a property.

See Properties for the total including explicitly-implemented properties like Y.

Targets By Language: Configuration: