Use internal : internal « Class « C# / CSharp Tutorial






  1. The internal modifier declares that a member is known throughout all files in an assembly, but unknown outside that assembly.
  2. The protected internal access level can be given only to class members.
  3. A member declared with protected internal access is accessible within its own assembly or to derived types.
using System; 
 
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); 
 
  } 
}
Here is ob.x: 10








7.19.internal
7.19.1.Use internal
7.19.2.Using Internal on Members