The .NET environment includes the following scope modifiers: public, internal, protected, internal protected, and private. Not all scope modifiers can be used at all times. When declaring types, only the modifiers public and internal can be used. All scope modifiers can be used when declaring methods or data members belonging to a type.
Following are the different types of scope modifiers:
§ public: Defines a type, method, or data member to be considered visible regardless of assembly or program scope. The public scope modifier is considered the loosest of scope modifiers, and therefore the most dangerous with respect to managing unwanted references.
§ internal: Defines a type, method, or data member that has a public scope in the context of an assembly. The type, method, or data member cannot be accessed from outside the assembly.
§ protected: Protected methods and data members are scoped as private by any code that attempts to use the method or data type directly. If the method or data member is called from a subclassed type, then the scope is more akin to public. For quick reference, protected means public or private scope depending on the context.
§ internal protected: This protection can only be applied to methods or data members, and is a combination of the internal and protected scope modifiers. This means a method or data member has public scope in the subclassed type.
§ private: Defines a method or data member that’s private and only accessible to the type defining the method or data member.
This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited.