Introduction and application of CTS (common type System) example

Source: Internet
Author: User
The CTS (common type System) common type systems stipulate that a type can contain 0 or more members, as follows: field: A data variable that is part of an object's state. A field distinguishes a method by its name and type: A function that performs an action on an object usually alters the state of the object. The method has a name, a signature, and one or more modifiers. The signature specifies the number of parameters (and their order); parameter type: Whether the method has a return value. If there is a return value, also specify the return value type attribute (Prolerty): For callers, the property looks like a field. However, for a type's implementation, the property appears to be a method (or two methods). property allows you to verify input parameters and object state before accessing the value, and to calculate a value only if necessary. Property also allows users of the type to adopt simplified syntax. Finally, properties allow you to create read-only or write-only field events: events implement notification mechanisms between objects and other related objects. For example, a button provides an event that notifies other objects when a button is clicked and the CTS also specifies the visibility rules and access rules for type members, such as if the type is marked as public, any assembly can see and access the type. However, if the tag is assembly (using the internal adornment in C #), only code in the same assembly can see and access the type, so with the rules developed by CTS, the Assembly establishes a visual boundary for a type, The CLR also enforces these rules: private: Members can only be accessed by other members of the same type; protected: Members can be accessed by derived classes, regardless of whether those types are in the same assembly. Internal: A member can be accessed by any code in the same assembly protected internal: a member can be accessed by a derived type in any assembly, and a member can be accessed by any type in the same assembly by any code in any assembly
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.