Internal

Why Trust Techopedia

What Does Internal Mean?

Internal, in C#, is a keyword used to declare the accessibility of a type or type member such that the access is limited to the assembly in which it is declared.

Advertisements

An internal modifier is used to prevent the use of a public modifier, which allows access to other assemblies wherever necessary. An internal modifier, therefore, is useful in implementing the concept of encapsulation in object-oriented programming at the assembly level. It is used in larger programs where information hiding across program boundaries can improve maintainability and security.

Internal is most often used in component-based development by allowing a specific group of components to communicate in a private manner and prevent access to the code that is not relevant to this group. Internal modifiers enable the access of members of an assembly from the friend assemblies that are designed for specific reasons such as unit testing, extensions to class libraries, etc.

Techopedia Explains Internal

Internal is one of the access modifiers that limits the access to types defined within the current project assembly. The default accessibility of classes and structs that are declared within a namespace or at the top level of a compilation unit and not within other types is internal.

For example, while developing a graphical user interface (GUI) application that involves customized GUI elements such as windows, forms, controls, etc., they can be specified with internal accessibility so that they cooperate privately without being exposed to the code that is using these elements.

Referencing a member with internal access from outside the assembly in which it is declared results in a compiler error. While using the internal members of an assembly that need to be accessed from a friend assembly, the name of the friend assembly should be specified with the attribute, InternalsVisibleToAttribute in the assembly where the internal members are defined.

An internal virtual method cannot be overridden in C#.

Advertisements

Related Terms

Margaret Rouse
Technology expert
Margaret Rouse
Technology expert

Margaret is an award-winning writer and educator known for her ability to explain complex technical topics to a non-technical business audience. Over the past twenty years, her IT definitions have been published by Que in an encyclopedia of technology terms and cited in articles in the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine, and Discovery Magazine. She joined Techopedia in 2011. Margaret’s idea of ​​a fun day is to help IT and business professionals to learn to speak each other’s highly specialized languages.