Eighth Chapter Summit Showdown-out of the wrong

Source: Internet
Author: User

Today is Sunday, yesterday saw a day of "Deer Ding kee", abandoned a day, today should spend some time to study, or the whole person will not be good. Learning is the king, do not learn always feel a sense of guilt.

This chapter is mainly about some of the similar names and functional similarities of some concepts and techniques of comparative learning, the author will lead us out of the misunderstanding, let us better understand the principles in depth.

Notes

I. Attributes and Attributes

1. Features: The common language runtime allows you to add a descriptive declaration of a similar keyword that labels elements in your program that can be used to describe code at run time, or to affect the behavior of a program as it runs.

Properties: Provides encapsulation of private fields, using get and set accessors to achieve a readable and writable operation.

2. The purpose of the feature is to add additional information to the target element (class, method, attribute, module, dataset, or even function parameter), similar to the comment, but can be obtained by means of reflection. Mainly used in serialization, compiler directives, design patterns and so on.

3, we can customize the characteristics according to their own needs, first of all the characteristics of the class category, so long as the rules of some characteristics, as long as the inheritance of System.Attribute can complete the declaration of custom attributes. At the same time, the reflection mechanism can be used to obtain the corresponding characteristics.

  

4. Attribute is a unique language feature of. NET, which plays a great role in the actual development process, and in-depth research will help you write simple and cool code.

Second, is and as

    

1, is mode:

Checks the compatibility of the object type, returns a result of true or false, does not throw an exception, or returns False if null.

  

2, as mode:

  

  

Eighth Chapter Summit Showdown-out of the wrong

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.