04. C # type system, value type, and reference type (Chapter 2 2.2-2.3 ),
All the things to be written today are conceptual things in the book. Just take notes and write them in the form of questions and conversations. Maybe there will be something to talk about during interviews in the future ~~~
Q1.C #1 What are the three features of the system type?
A1.C #1 is static, explicit, and secure.
Q2. why is it a static type?
A2static type is used to describe the type of the expression during compilation. When declaring a type variable, the variable cannot point to other types of objects.
Q3. What are the differences between explicit and implicit types?
A3. explicit and implicit types are valid only for languages in static types. Explicit type requires explicit declaration of the type of a variable, while implicit type pushes the responsibility for determining the type to the compiler. However, during compilation, the type of the variable is known.
Q4. which of the following types are the value type and reference type respectively?
A4. the class is the reference type, the structure is the value type, the array type is the reference type, the enumeration is the value type, the delegate is the reference type, and the interface is the reference type.
Q5. judge whether the following statements are true or false.
1. The structure is a lightweight class.
2. The reference type is stored on the stack, and the value type is stored on the stack.
3. Objects in C # are passed by reference by default.
A5. the above three statements are all incorrect.
In Q6.C #4, if dynamic types are to be used, what keywords are used?
A6.dynamic, such as dynamic o = "kkk", the responsibility for this type of judgment is pushed to the runtime.
Please make an axe.