Saturday, October 16, 2010

C#: Quick Reference – Access Modifiers

C# Access Modifiers
Declared AccessibilityDescription
publicAccess is not restricted.
protectedAccess is limited to the containing class or types derived from the containing class.
internalAccess is limited to the current assembly.
protected internalAccess is limited to the current assembly or types derived from the containing class.
privateAccess is limited to the containing type.
Declared Accessibility Rules
ParentParent Default
Accessibility
Allowed
Declared
Accessibility
of the
Parent
Member
Default Accessibility
Allowed
Declared
Accessibility
of the
Member
namespacepublicNoneinternalinternal
public
enumpublicNonepublicNone
classinternalAllprivateAll
interfaceinternalinternal
public
publicNone
structinternalinternal
public
privateinternal
public
private
constructorprotectedAll
fieldprivateAll
delegateinternalinternal
public

No comments: