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