C# Access Modifiers - C# Modifiers
C# Access Modifiers
- In C# Access Modifiers or specifiers are the keywords that are used to specify accessibility or scope of variables and functions.
- In C# there are five types of access specifiers:
Public Access Specifier
- It makes data accessible publicly and it does not restrict data to the declared block.
- It specifies that access is not restricted.
- It is accessible for all classes.
Private Access Specifier
- Private Access Specifier is used to specify private accessibility to the function or variable.
- It is most accessible and restrictive only within the body of class in which it is declared.
Protected Access Specifier
- Protected is accessible within the class and has limited scope.
- In case of inheritance, it is also accessible within sub class or child class.
Internal Access Specifier
- Internal is used to specify the internal access specifier for the variables and functions.
- This access specifier is accessible only within files in the same assembly.
- It is only accessible within its own assembly, but not from another assembly.