Interview Questions: C #(1 ),
This series is continuously updated to collect issues from the Internet and around you
1. What are the accessibility levels?
Public access is unrestricted.
Protected access is limited to include classes or types derived from include classes.
Internal access is limited to the current Assembly.
Protected internal access is limited to the current Assembly or type derived from the include class.
Private access is limited to the inclusion type.
2. Differences between String and StringBuilder
The String class is unchangeable. Each time you perform the character operation, a New String object is created.
The StringBuilder object has only one object after initialization.
It is better to use StringBuilder for frequent operations or String concatenation
* String is a reference type and is stored on the stack.
3. Differences between Struct and Class
Class is the reference type, and structs is the value type
Class is created on the stack. Struct is created on the stack
Class can have an initialization tool, and struct cannot have an initialization tool.
Class can have a non-parameter constructor, but Struct cannot.
Class must be instantiated before use, struct does not need
Class supports inheritance and polymorphism, and struct does not.
The class constructor does not need to initialize all fields. The struct constructor must Initialize all fields.
Class has the object-oriented extension advantage, and struct has the performance advantage.
4. Application domain? Managed code? Strong system? Packing and unpacking? Overload?
Application domain (AppDomain)
It can be seen as a lightweight process. A process can contain multiple application domains, and an application domain can load an executable program (*. exe) or multiple assembly (*. dll ). In this way, application domains can be deeply isolated. Even if an error occurs in an application domain in the process, the normal operation of other application domains will not be affected.
Managed Code)
The intermediate language (IL) code is the code executed by the Common Language Runtime Library (CLR), instead of being directly executed by the operating system. The CLR is converted to the computer language and interpreted to the computer.
Strongly typed system
All variables must be of the specified type. Before forced type conversion, two different types of variables cannot be operated on each other.
Packing and unpacking
The box is to convert the value type to the reference type, and the box is to convert the reference type to the value type
Heavy Load
Two or more methods with the same name but different parameters in the same class
5. What are the explanations of CTS, CLS, and CLR?
Http://www.cnblogs.com/zagelover/articles/2741370.html
CTS Common Type System)
Describes the type definition and behavior.
Common Language Specification)
Is a subset of CTS, which defines the minimum specification required for the language of the program to be written on the. NET platform.
Common Language Runtime)
CLR is the implementation of CTS. That is to say, CLR is the execution engine of the application and a class library with complete functions. This class library is implemented in strict accordance with the CTS specifications.
6. What is GC?
The CLR garbage collection mechanism automatically recycles non-referenced objects on the stack according to "Generation ".
To be continue...