当前位置:网站首页>Chapter I: Net architecture (1)
Chapter I: Net architecture (1)
2022-06-11 05:05:00 【Skill code brother】
1、C# And .NET The relationship between
C# The compiler is designed for .NET, This means using C# All the code you write is always .NET Framework Run in . about C# language , Two important conclusions can be drawn :
(1)C# The structure and methodology of .NET Basic methodology .
(2) in many instances ,C# The specific language functions of depend on .NET The function of , Or depend on .NET Base class .
C# The importance of is reflected in the following two aspects :
- It is dedicated to Microsoft Of .NET Framework Designed for use with (.NET Framework It is a platform with rich functions , Developable 、 Deploy and execute distributed applications ).
- It is a language based on modern object-oriented design method , When designing it ,Microsoft It also draws on the experience of all other similar languages .
C# In itself, it's just a language , Although it is used to generate oriented .NET The code of the environment , But this province is not .NET Part of ..NET Some features supported ,C# Does not support . and C# Other features supported by the language ,.NET But I do not support ( Such as operator overloading )!
2、 Common language runtime
.NET Framework The core of is its runtime execution environment , It's called the common language runtime (CLR) or .NET Runtime . Usually will be CLR Code that runs in control is called managed code (managed code).
however , stay CLR Execute the written source code ( Use C# Or code written in other languages ) Before , They need to be compiled . stay .NET in , Compilation is divided into two stages :
(1) Consider the source code as Microsoft Intermediate code (IL).
(2) hold CLR hold IL That is, the platform specific code .
Microsoft Interlanguage and Java Keywords share an idea : They are all low-level languages , The grammar is very simple ( Use numeric codes , Not text code ), It can be converted to local machine code very quickly . For code , This well-designed general syntax has important advantages : Platform independence 、 Improve performance and language interoperability .
2.1、 Platform independence
First , This means that the same file containing bytecode instructions can be placed on any platform . The final stage of the run-time compilation process can be easily completed , In this way, di'ama can run on a specific platform . In other words , I thought that the intermediate language could be obtained .NET Platform independence , This is the same as thinking Java Bytecode will get Java Platform independence is the same .
2.2、 Improve performance
actually ,IL Than Java Bytecode is even more important .IL Always compiled on the fly ( be called JIT compile ), and Java Bytecode is often interpretative .Java One of the disadvantages of , When running the application , hold Java The process of converting bytecode to internal executable code will lead to the loss of myocardial infarction .
JIT The compiler does not compile the entire application at once ( This will have a long start-up time ), Instead, compile only the part of the code it calls ( This is the origin of its name ). Once the code has been compiled , The resulting local executable is stored , Until you exit the application , So the next time you run this part of the code , There is no need to recompile .
trusteeship IL Code executes almost as fast as native machine code , The reason is that the last part of the compilation process is done at run time ,JIT The compiler knows exactly what type of processor the program is running on , Any features or specific machine code instructions provided by the processor can be used to optimize the final executable code .
Traditional compilers optimize code , But their optimization process is independent of the specific processor running the code . This is because the traditional compiler compiles the executable code of the local machine before releasing the software . That is, the compiler does not know the type of processor running the code ,
1.2.3、 Language interoperability
Use IL Not only does it support platform independence , It also supports language interoperability . In short , Is to be able to compile any language into an intermediate language , Code compiled into an intermediate language can interoperate with code compiled from other languages .
(1)VB
(2)VC++
C++ An interesting problem with is when compiling into managed code , The compiler can generate a program that contains embedded local executables IL. This means that in C++ You can combine gate types and unmanaged types in your code , So trusteeship C++ Code :
class MyClass
Defines a common C++ class , The code :
ref class MyClass
Generated a managed class , It's like using C# or VB2012 Just like writing classes . actually , trusteeship C++ Code ratio C# The better thing about the code is that it can be hosted C++ Calling unmanaged... In code C++ class , Instead of this Yong COM Interoperability features .
If you use... On managed types .NET Unsupported feature ( for example , Multiple inheritance of templates or classes ), The compiler will get an error . in addition , When using the exit class , You also need to use non-standard C++ function .
Written using .NET Of C++ The program will get several different interoperability scenarios . Use compiler settings /clr When common language runtime support is enabled , You can completely mix all local and managed C++ function . Other options can limit C++ Use of the pointer , So as to use C# and VB Write safe code like that .
(3)COM and COM+
Technically speaking ,COM and COM+ Not for .NET Technology , Because components based on them cannot assume that IL( But if the original COM Components are made of C++ Compiling , Then use hosting C++ To some extent, this can be done ). however ,COM+ Still an important tool , Because it contains some .NET Features not available . in addition ,COM Components can still be used –.NET Inherited COM Interoperability of , This allows managed code to call COM Components ,COM Components can also call managed code . In general , Write the new build as .NET Components , Mostly for convenience , Because it can make use of .NET Other benefits of base classes and managed code .
(4)Windows Runtime
边栏推荐
- Emnlp2021 𞓜 a small number of data relation extraction papers of deepblueai team were hired
- 一大厂95后程序员对部门领导不满,删库跑路被判刑
- Sealem Finance打造Web3去中心化金融平台基础设施
- [Transformer]MViTv1:Multiscale Vision Transformers
- go单元测试实例;文件读写;序列化
- The data center is evolving towards the "four high" trend, and the OCP network card and the whole cabinet will be delivered into the mainstream of the future data center
- KD-Tree and LSH
- go MPG
- [Transformer]MViTv2:Improved Multiscale Vision Transformers for Classification and Detection
- Huawei equipment is configured with bgp/mpls IP virtual private network address space overlap
猜你喜欢

Win10+manjaro dual system installation

White Gaussian noise (WGN)

BP neural network derivation + Example

点击图标不灵敏咋整?

Sealem Finance打造Web3去中心化金融平台基础设施

Emnlp2021 𞓜 a small number of data relation extraction papers of deepblueai team were hired

Free data | new library online | cnopendata data data of national heritage stores and auction enterprises

华为设备配置MCE

Take stock of the AI black technologies in the Beijing Winter Olympic Games, and Shenzhen Yancheng Technology

Codesys get System Time
随机推荐
AAAI2022-ShiftVIT: When Shift Operation Meets Vision Transformer
Exhibit express: Lianrui will bring three new products of the industry to debut in visionchina (Shenzhen) 2021
White Gaussian noise (WGN)
[Transformer]CoAtNet:Marrying Convolution and Attention for All Data Sizes
MySQL regularly deletes expired data.
Emnlp2021 𞓜 a small number of data relation extraction papers of deepblueai team were hired
Wechat applet uploads the data obtained from database 1 to database 2
力扣(LeetCode)161. 相隔为 1 的编辑距离(2022.06.10)
What is the difference between a wired network card and a wireless network card?
Restoration of binary tree -- number restoration
Zed2 running vins-mono preliminary test
The data center is evolving towards the "four high" trend, and the OCP network card and the whole cabinet will be delivered into the mainstream of the future data center
New product pre-sale: 25g optical network card based on Intel 800 series is coming
Titanic rescued - re exploration of data mining (ideas + source code + results)
Simple linear regression of sklearn series
C language test question 3 (advanced program multiple choice questions _ including detailed explanation of knowledge points)
【入门级基础】Node基础知识总结
Zed2 camera manual
Technical dry goods: how to select the most suitable RDMA network card
lower_ Personal understanding of bound function