A: What is the role of the Internal modifier?
The internal modifier can be used for types or members. The type or member declared using this modifier can only access the interface within the same set. It is worth noting that the internal modifier cannot be used, if the protected modifier is added to the internal Member, the access level is internal or protected. It is easy to make a mistake to look at the literal meaning. Many people think that internal protected should be "only the sameProgramThe subclass of the set can be accessed, but it actually means "all classes in the same assembly, and all subclasses in the Assembly can be accessed"
Example
Class1 of example05lib
Code Using System; Using System. Collections. Generic; Using System. text; Namespace Example05lib { Public Class Class1 { Internal String strinternal = Null ; Public String strpublic; Internal Protected String strinternalprotected = Null ;}}
Result
The class2 class of the example05lib project can access the strinternal member of class1, but also the strinternalprotected member because they are in the same set of programs.
The class3 class in the example05 project cannot access the strinternal members of class1 because they are not in the same assembly. However, you can access the strinternalprotected member because class3 is an inherited class of class1.
The program class of the example05 project cannot access the strinternal members of class1 or strinternalprotected members because they are neither in the same Assembly nor have an inheritance relationship B.
B: Field and attribute Problems
Field: variable associated with a class or object. Generally, the access domain is private: fields are encapsulated and read/write operations are performed by the accessors, it is generally public property is the object that can be used when the class is provided to external calls. attribute setting or reading a value get {Reture xxx;} indicates the readable set {xxx = value;} indicates that the writable field is used inside the class. store Data