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
Editor

Margaret jest nagradzaną technical writerką, nauczycielką i wykładowczynią. Jest znana z tego, że potrafi w prostych słowach pzybliżyć złożone pojęcia techniczne słuchaczom ze świata biznesu. Od dwudziestu lat jej definicje pojęć z dziedziny IT są publikowane przez Que w encyklopedii terminów technologicznych, a także cytowane w artykułach ukazujących się w New York Times, w magazynie Time, USA Today, ZDNet, a także w magazynach PC i Discovery. Margaret dołączyła do zespołu Techopedii w roku 2011. Margaret lubi pomagać znaleźć wspólny język specjalistom ze świata biznesu i IT. W swojej pracy, jak sama mówi, buduje mosty między tymi dwiema domenami, w ten…