[C # advanced series] 06 types and member bases,
These things are the foundation of the Foundation. Basically, this is what we will talk about in this book. But a lot of things are everywhere, so I just wrote down the following.
Visibility and accessibility of Types
This is something like public and internal, but there is something to mention, that isYouyuan assembly.
Using the InternalsVisibleTo feature in System. Runtime. CompilerServices, you can access the internal type of the specified assembly from a friend assembly. (It is used to access the internal method and attributes by specifying the public key and the name of the Peer Assembly. In fact, it is used to make other companies unable to access the method, but their own companies can access it .)
Division class
The partial keyword can distribute the Definition source code of a class, structure, or interface to multiple files. (If this class is too large)
(In fact, as mentioned in refactoring, a large class often needs to be reconstructed. You may use the partial method to solve the problem, but instead it masks the issue that needs to be reconstructed)
Partial is used in the C # compiler stage. At this time, several partial classes have already been combined. CLR knows nothing about this function.
Virtual Methods
Virtual methods do not call non-Virtual Methods quickly, and too many virtual methods will reduce the performance.
Define class principles
When defining a class, the specified sealed should be displayed unless you are sure to use it as the base class and allow the derived class to be special.