of is about public private protected internal

  • 2021-01-18 06:23:00
  • OfStack

1. private modifier

The private modifier is used to set access to a class or a class member only inside the class to which it belongs,
private is also known as a private modifier. Private class members can sometimes be read or modified through get and set accessors when they need to be accessed.

2. protected modifier

The protected modifier is used to set that access to a class or a class member is only internal to the class and subclasses to which it belongs.

3. internal modifier

The default class access modifier for C# is internal. The default class access modifier for C# is internal.

4. public modifier

The public modifier is public access and does not restrict access to code.
The public modifier must be used with caution in most cases, as abuse can affect class encapsulation and pose a security risk.

Accessibility meaning of declarations
Access to ES34en is unrestricted
protected access is limited to containing classes or types derived from containing classes
internal access is limited to the current project
protected internal access is limited to the current project or type derived from the containing class
private access is limited to include types


Related articles: