We can use five types of access modifiers in the c# programming language. It is mentioned below:
- Private
- Public
- Protected
- Internal
- Protected Internal
Private - We can access private modifiers only inside the same class within an assembly.
Public - We can access public modifiers anywhere in an assembly and another assembly. E.g. - Same, Derived, and Non-derived class.
Protected - We can use protected modifiers only in the Same & Derived class within an assembly, it is not accessible in the Non-Derived class.
Internal - We can access internal modifiers in all classes within an assembly. E.g.- Same, Derived, and Non-Derived class.
Protected Internal - It is the combination of internal and protected internal access modifiers.