1.private modifier
The private modifier is used to set the access rights of a class or class member to the internal of the owning class only.
Private is also known as a proprietary modifier. When you need to access a private class member at some point, you can read or modify it through get and set accessors.
2.protected modifier
The protected modifier is used to set the access rights of a class or class member to only the internal of the owning class and subclass.
3.internal modifier
The internal modifier modifies the access rights of the class or class member within the same assembly, and the C # default class access modifier is internal.
4.public modifier
The public modifier is common access, and there is no restriction on access to the code.
In most cases, the public modifier must be used sparingly, because abuse affects the encapsulation of the class and poses a security risk.
The accessibility meaning of the Declaration
Public access is unrestricted
Protected access is limited to the containing class or types derived from the containing class
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 the containing type