Skip to content
Author: ytianle

Internal Classes⚓︎

Internal Class⚓︎

In C#, a class with the internal access modifier:

  • can be referenced from anywhere in the same assembly.
  • cannot be referenced directly from a different assembly.
Assembly?

An assembly is a compiled code library used for deployment, versioning, and security in .NET. Different assemblies can be thought of as different projects or modules in a larger application.

Solutions usually contain multiple projects, and each project compiles into its own assembly.

internal class ReportFormatter
{
    public string Format(string title) => $"Report: {title}";
}

public class ReportService
{
    public string BuildTitle()
    {
        var formatter = new ReportFormatter();
        return formatter.Format("Annual Summary");
    }
}