C# Internal Access Modifier
Using internal member
The internal modifier declares that a member is known throughout all files in an assembly, but unknown outside that assembly. The protected internal access level can be given only to class members. A member declared with protected internal access is accessible within its own assembly or to derived types.
using System; /*from w w w . j a va 2 s .c om*/
class InternalTest {
internal int x;
}
class MainClass {
public static void Main() {
InternalTest ob = new InternalTest();
ob.x = 10; // can access -- in same file
Console.WriteLine("Here is ob.x: " + ob.x);
}
}
The code above generates the following result.
Next chapter...
What you will learn in the next chapter:
C# Access Modifiers
C# Private Access Modifier
C# Public Access Modifier
C# Protected Access Modifier
C# Private Access Modifier
C# Public Access Modifier
C# Protected Access Modifier