All rules
CA1515Maintainability Enabled by default: No

Consider making public types internal

Consider making public types internal

Microsoft docs

Description

Unlike a class library, an application's API isn't typically referenced publicly, so types can be marked internal.

Internal types, in turn, can benefit from various code analyzers that target non-public APIs.

Cause

A type inside an executable assembly is declared as public.

How to fix violations

Mark the type as internal.

Example

// Inside a project with <OutputKind>Exe</OutputKind>.
public class Program
{
    public static void Main(string[] args)
    {
    }
}

// Inside a project with <OutputKind>Exe</OutputKind>.
internal class Program
{
    public static void Main(string[] args)
    {
    }
}

When to suppress

It's safe to suppress a violation of this rule if you're not concerned about the maintainability of your code.

Group results
0 yes 0 no
ConsensusNone (disabled)
Severity preference (yes voters)
Suggestion0
Warning0
Error0