C#

Access Modifiers in C#

Access modifiers are keywords that are used to specify accessibility of a type or a member.
In C#, the following accessaability levels are available:

  • public – type or member can be accessed from any place, there is no restriction on accessibility.
  • private – it does not allow to access the element from outside of the class or structure.
  • protected – it allows to access type or member within the same class, derived class or structure.
  • internal – type or member can be accessed within the same assembly.
  • protected internal – type or member can be accessed within the same assembly as well as by any derived class.
  • private protected – it allows to access type or member within the same class or derived class, in the same assembly.

Leave a Reply

Your email address will not be published. Required fields are marked *