Mega Code Archive

 
Categories / C# Book / 01 Language Basics
 

0090 Class and Struct Accessibility

Classes and structs that are declared directly within a namespace can be either public or internal. Internal is the default if no access modifier is specified. Struct members, including nested classes and structs, can be declared as public, internal, or private. Class members, including nested classes and structs, can be public, protected internal, protected, internal, or private. The access level for class members and struct members, including nested classes and structs, is private by default. Derived classes cannot have greater accessibility than their base types. You can enable specific other assemblies to access your internal types by using the InternalsVisibleToAttribute