Thursday, December 2, 2010

Access Modifiers- C#

1. public - Access is not restricted.
2. internal - Access is limited to the current assembly.
3. private - Access is limited to the containing class.
4. protected - Access is limited to the containing class or types derived from the containing class.
5. protected internal - Access is limited to the current assembly or types derived from the containing class.

Access modifiers are not allowed on namespaces. Namespaces have no access restrictions. If no access modifier is specified in a member declaration, a default accessibility is used.

Members - "Default member accessibility" - "Allowed declared accessibility"
class private public, protected, internal, private, protected internal
interface public None
struct private public, internal, private
enum public None

the accessibility domain of a nested type cannot exceed that of the containing type.

No comments: