In C #, there are five access modifiers: private, protected, internal, and public) and protectde internal (only the types in this program or inherited from this class can be accessed ).
Objects modified with access modifiers include namespace (namespace), class (class), struct (structure), enum (enumeration), interface (interface), and delegate (delegate) and their members. Next we will explain it one by one.
1. namespace: it has an implicit public category and cannot be explicitly added with any access modifier. However, the namespace member function has the public or internal access level.
2. Enumeration members: Like namespaces, only public access levels are available, and access modifiers cannot be added to enumeration members.
3. struct and class: When only included in namespace, the default value is internal level, which can be displayed as adding public and internal for it; when included in a class, it can be a protected or private modifier.
4. delegate: The default value is internal.
5. interface: different from the class, the interface has the internal level by default. The interface can also be declared as public or internal.
6. Class Members: there are 5 access levels. The default value is private.
7. structure members: public, private, and internal access level. The default value is private, because the structure is implicitly closed. Because the structure does not have an inheritance relationship, you cannot use protected or protected internal to modify the structure members.
8. Interface members: Same as enumeration members, they have the public level, but cannot be explicitly added with the public keyword.