1.private modifier
The private modifier is used to set the access rights of a class or class member only to the inside of the owning class.
Private is also known as a private modifier. Sometimes when you need access to a private class member, you can read or modify it through the get and set accessors.
2.protected modifier
The protected modifier is used to set the access rights of a class or class member only to the inside of the owning class and subclass.
3.internal modifier
The internal modifier modifies the access rights of a class or class member inside the same assembly, and the C # default class access modifier is internal.
4.public modifier
The public modifier is publicly accessible and has no restrictions on access to the code.
In most cases, the public modifier must be used with caution, because abuse affects the encapsulation of classes and poses a security risk.
Accessibility implications of claims
Public access is not restricted
Protected access is limited to types that contain or derive 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
Introduction to the ASP. NET modifier (about public, private, protected, internal)