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 é uma premiada redatora e professora conhecida por sua habilidade de explicar assuntos técnicos complexos para um público empresarial não técnico. Nos últimos vinte anos, suas definições de TI foram publicadas pela Que em uma enciclopédia de termos tecnológicos e citadas em artigos do New York Times, Time Magazine, USA Today, ZDNet, PC Magazine e Discovery Magazine. Ela ingressou na Techopedia em 2011. A ideia de Margaret de um dia divertido é ajudar os profissionais de TI e de negócios a aprenderem a falar os idiomas altamente especializados uns dos outros.