English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Today's things to write are some conceptual things in the book, just copy notes, and write them in the form of questioning dialogue, maybe it can be a little resource for interviews~~~
Q1.C#1What are the three characteristics of system types?
A1.C#1The type system is static, explicit, and safe.
Q2Why is it called static type?
A2Static types are used to describe the type of an expression at compile time. When a type variable is declared, the variable cannot be pointed to other type objects.
Q3What is the difference between explicit types and implicit types?
A3Explicit types and implicit types only have meaning in statically typed languages. Explicit types need to explicitly declare the type of a variable, while implicit types push the responsibility of type judgment to the compiler, but at compile time, the type of the variable is known.
Q4Value types and reference types, respectively, what types of classes, structures, array types, enums, delegate types, and interface types belong to above types?
A4Classes are reference types, structures are value types, array types are reference types, enums are value types, delegates are reference types, and interfaces are reference types.
Q5Judge whether the following statements are right or wrong.
1Structures are lightweight classes.
2Reference types are stored on the heap, value types are stored on the stack.
3Objects in C# are passed by reference by default.
A5The above three statements are all wrong.
Q6.C#4In C#, what keyword is used to use dynamic types?
A6.dynamic, such as dynamic o = "kkk", the responsibility of type judgment is pushed to runtime.
The above-mentioned is the type system in C# introduced by the editor (value types and reference types), I hope it will be helpful to everyone. If you have any questions, please leave me a message, and the editor will reply to everyone in a timely manner!