C # Program Design Notes (chapter 7)

Source: Internet
Author: User
Chapter 7
1. C # attributes are composed of a field declaration and accessors used to modify the field value. These accessors are called the "Getter" and "setter" methods.
2. The getter method is used to obtain the value of a field (read-only attribute). The setter method is used to modify the value of a field (writable attribute)
3. When the compiler parses the C # Attribute syntax, it actually produces the appropriate getter and setter methods for us.
4. Three Functions of attributes
1) They provide prime ministers at a certain level for Customer Code
2) through the object. Field syntax format, they provide a common method for the struct class members
3) They allow the class to perform other operations when modifying or accessing a specific field.
5. You can use arrays to store and track a group of dynamically allocated objects. in C #, the common base class of array objects is system. array.
6. When an array is declared, the array is not actually created and must be instantiated before the array is allocated.
7. When declaring an array as a member of a class, the declared array and the instantiated array must be divided into two different steps. Therefore, the object can be instantiated only when running.
8. In a unique array, the Length attribute returns the number of all elements in the array.
9. the uniqueness of the array is called the "rank" of the array, and the "rank" can be obtained through the array. Rank attribute.
10. A jagged array is an array.
11. Use the indexer to treat objects as arrays. Attribute is called "intelligent field", and indexer is called "intelligent array ".
12. The definitions of the indexer and the definition attributes are similar, but there are two differences:
1) The indexer has the index parameter value.
2) because the class itself is used as an array, the keyword "this" is used as the name of the indexer.

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.