scitools.com

← Metric catalog

Protected Internal Methods 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.

Protected Internal Methods

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

Number of local protected internal methods.

A protected internal method (C#'s protected internal access modifier) is accessible from anywhere in the same assembly, or from derived classes in other assemblies.

For example:


namespace MetricsDemo
{
    public class AccessModifiers
    {
        internal int InternalField;
        protected internal int ProtectedInternalField;

        internal void InternalMethod()
        {
            InternalField++;
        }

        protected internal void ProtectedInternalMethod()
        {
            ProtectedInternalField++;
        }
    }
}

ProtectedInternalMethod() is the only protected internal method, giving CountDeclMethodProtectedInternal = 1. InternalMethod() is plain internal — a narrower access level — so it doesn't count here.

See Methods for the total across all access levels, and Internal Methods for the related access level. Public Methods, Protected Methods, and Private Methods cover the access levels shared with C++ and Java, and Default Methods covers Java's package-private methods.

Targets By Language: Configuration: