In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
Most people don't understand the knowledge points of this article, so Xiaobian summarizes the following contents for everyone. The contents are detailed, the steps are clear, and they have certain reference value. I hope everyone can gain something after reading this article. Let's take a look at this article together.
1. What is. NET? What is CLI? What is CLR? What is IL?
(1). net An integrated managed environment for code compilation and execution, in other words, it manages all aspects of application execution, including compilation for the first time, allocating memory for the program
Store data and instructions, grant or deny permissions to applications, and initiate management of application execution and allocation of remaining memory. Thanks to all. net apps
All are executed on top of the. net framework, so developers only need to think about dealing with the. net framework, not the implementation of the underlying operating system.
Includes CLR and BCL
CLI(Common Language Infrastructure) is an international standard that does not specify how to implement it. Instead, it describes a world
What behavior the CLI platform should have to comply with standards. Contains: Runtime (CLR), Common Intermediate Language (CIL), Common Type System (CTS),
Common Language Specification (CLS), Metadata, Framework
(3)CLR: common language runtime, responsible for loading and running programs IL: intermediate language, C#compiler converts C#code into IL, runtime can understand IL, and compile into machine code
What is JIT and how does it work? What is GC and how does GC work?
JIT: Just in time, C#or VB. NET code is first compiled into IL stored locally, and when it is time to run the code, CLR compiles IL a second time and converts it into machine code. Benefits: Portability, and IL is checked for type safety when loaded into memory, which allows for better security and reliability.
GC: Garbage collection is the process of automatically allocating and reclaiming memory according to the needs of a program. The garbage collector deals with reference objects and only collects memory on the heap. This means that maintaining a reference to an object prevents GC from reusing memory used by the object. In. NET, garbage collectors use the mark-and-compact algorithm. At the beginning of a garbage collection cycle, it identifies all references to the object, and from this reference it can traverse a tree structure identified by each root reference and recursively determine the object to which all references point. In this way, the garbage collector can identify all reachable objects, and when performing collection, GC does not enumerate all inaccessible objects, but instead performs garbage collection by compressing all adjacent reachable objects. Objects that are inaccessible are overwritten. Garbage collection is designed to improve memory utilization. It is not used to clean file handles, database connection strings, ports, or other limited resources (finalizer, which cannot be explicitly called, cannot pass any parameters, that is, cannot be overloaded, only garbage collectors can call finalizers, and use Using statements for deterministic termination).
3. What is the difference between a class and a struct? Do they affect performance?
1. Value types versus reference types
Structure is value type: value type assigns address on stack, all base types are structure type, for example: int corresponds to System.int32 structure, more value types can be created by using structure
Class is a reference type: Reference types allocate addresses on the heap stack execution efficiency is higher than the heap execution efficiency, but the stack resources are limited, not suitable for processing large logically complex objects. So structs handle small objects treated as base types, and classes handle some business logic because structs are value types, so assignments between structs create new structs, and classes are reference types, and assignments between classes are just copy references.
Note: 1. Although the structure is different from the type of class, their base type is object, and the base type of all types in c#is object.
2. Although the initialization of the struct also uses the New operator, the struct object is still allocated on the stack rather than on the heap. If you do not use new, the fields will remain unassigned until all fields are initialized, and the object will not be available.
2. inheritance
Structure: cannot inherit from another structure or class, nor can it be inherited, although the structure is not explicitly declared as sealed, but the structure is implicitly sealed .
class: fully extensible, classes can inherit other classes and interfaces, and themselves can be inherited unless the explicit declaration is sealed Note: Although structures cannot be inherited, structures can inherit interfaces, methods, and classes inherit interfaces
3. Internal structure:
struct: no default constructor, but can add constructors no destructors no abstract and sealed(because inheritance is not possible) cannot have protected modifiers can not initialize instances in structs with new fields are wrong
Class: has default constructor has destructor can use abstract and sealed has protected modifier must use new initialization
The above is the content of this article about "what are the common test questions of. net". I believe everyone has a certain understanding. I hope the content shared by Xiaobian will be helpful to everyone. If you want to know more relevant knowledge content, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.