Access Specifiers in C#
Within a class definition, you provide definitions for all members of the class, including fields, methods, and properties. All members have their own accessibility levels, defined in all cases by one of the following keywords:
|public||Members are accessible from any code.|
|private||Members are accessible only from code that is part of the class (the default if no keyword is used).|
|internal||Members are accessible only from code within the project (assembly) where they are defined.|
|protected||Members are accessible only from code that is part of either the class or a derived class.|
The last two of these can be combined, so protected internal members are also possible. These are only accessible from code – derived classes within the project (more accurately, the assembly).
Fields, methods, and properties can also be declared using the keyword static , which means that they are static members owned by the class, rather than by object instances