Home  >  Article  >  Backend Development  >  What is managed code in C#?

What is managed code in C#?

WBOY
WBOYforward
2023-09-07 10:53:021420browse

C# 中的托管代码是什么?

Managed code is code that is managed and executed by the common language runtime (CLR). It takes managed code and compiles it into machine code. After that, the code is executed.

The runtime here is the CLR, which provides automatic memory management, type safety and other functions.

Managed code is written in a high-level language and runs on .NET. It can be C#, F#, etc. Code compiled using their compiler does not produce machine code. However, you will get intermediate language code, compiled and executed by the runtime.

C/C code is called "unmanaged code" and it does not have this privilege. It is the responsibility of the operating system to load programs into memory in binary form. Programmers need to handle the rest themselves.

C It is also possible to generate unmanaged binaries that run on Windows.

C# allows the use of unmanaged constructs of unsafe contexts directly in code, which sets up a section of code that is not managed by the CLR.

The above is the detailed content of What is managed code in C#?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete