[C # advanced series] 06 types and member bases,

Source: Internet
Author: User

[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.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.