C# Access Modifiers
Public - access to all.
Private - access limited to only with in the class.
Protected - access limited to with in the class and derived class.
Internal - access to all with in the same project assembly
Protected Internal - access to the same assembly and derived class.
Private Protected - access in the same class and derived class
| Modifier | Description |
| public | There are no restrictions on accessing public members. |
| private | Access is limited to within the class definition. This is the default access modifier type if none is formally specified |
| protected | Access is limited to within the class definition and any class that inherits from the class |
| internal | Access is limited exclusively to classes defined within the current project assembly |
| protected internal | Access is limited to the current assembly and types derived from the containing class. All members in current project and all members in derived class can access the variables. |
| private protected | Access is limited to the containing class or types derived from the containing class within the current assembly. |
Comments
Post a Comment