.NET Core - Code Execution
2021/8/6 23:08:20
本文主要是介绍.NET Core - Code Execution,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
In this chapter, we will understand the execution process of .NET Core and compare it with the .NET Framework. The managed execution process includes the following steps.
- Choosing a compiler
- Compiling your code to MSIL
- Compiling MSIL to native code
- Running code
Choosing a Compiler
-
It is a multi-language execution environment, the runtime supports a wide variety of data types and language features.
-
To obtain the benefits provided by the common language runtime, you must use one or more language compilers that target the runtime.
Compiling your code to MSIL
-
Compiling translates your source code into Microsoft Intermediate Language (MSIL) and generates the required metadata.
-
Metadata describes the types in your code, including the definition of each type, the signatures of each type's members, the members that your code references, and other data that the runtime uses at execution time.
-
The runtime locates and extracts the metadata from the file as well as from framework class libraries (FCL) as needed during execution.
Compiling MSIL to Native Code
-
At execution time, a just-in-time (JIT) compiler translates the MSIL into native code.
-
During this compilation, code must pass a verification process that examines the MSIL and metadata to find out whether the code can be determined to be type safe.
Running Code
-
The common language runtime provides the infrastructure that enables the execution to take place and services that can be used during execution.
-
During execution, managed code receives services such as garbage collection, security, interoperability with unmanaged code, cross-language debugging support, and enhanced deployment and versioning support.
.NET Core Code Execution Process
Now let’s relate how code executes with .NET Core as compared to .NET Framework. In .NET Core there are many replacements of these components that are the part of the .NET Framework.
-
In .NET Core now we have a new series of compilers, like we have Roslyn for C# and VB.
-
You can also make use of the new F# 4.1 compiler if you want to use F# with .NET Core.
-
Actually these tools are different and we can use Roslyn with .NET Framework as well if we are using C# 6 or later, because C# compiler can only support up to C# 5.
-
In .NET Core, we don’t have a framework class libraries (FCL), so a different set of libraries are used and we now have CoreFx.
-
CoreFx is the reimplementation of the class libraries for .NET Core.
-
We also have a new run time with .NET Core known as CoreCLR and leverages a JIT Compiler.
-
Now the question is why do we have the reimplementation of all these components that we already have in .NET framework.
-
So the answer is the same as why Microsoft implemented .NET Core
这篇关于.NET Core - Code Execution的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2022-03-01沐雪多租宝商城源码从.NetCore3.1升级到.Net6的步骤
- 2024-11-15C#中怎么从PEM格式的证书中提取公钥?-icode9专业技术文章分享
- 2024-11-14云架构设计——如何用diagrams.net绘制专业的AWS架构图?
- 2024-05-08首个适配Visual Studio平台的国产智能编程助手CodeGeeX正式上线!C#程序员必备效率神器!
- 2024-03-30C#设计模式之十六迭代器模式(Iterator Pattern)【行为型】
- 2024-03-29c# datetime tryparse
- 2024-02-21list find index c#
- 2024-01-24convert toint32 c#
- 2024-01-24Advanced .Net Debugging 1:你必须知道的调试工具
- 2024-01-24.NET集成IdGenerator生成分布式全局唯一ID