C # understanding of managed code and unmanaged code,

Source: Internet
Author: User

C # understanding of managed code and unmanaged code,

To understand managed and unmanaged code, you must first understand CLR (Common Language Runtime Library)

. Net Framework is composed of two independent and related parts: CLR and class library. CLR is the service it provides for us, and class library is the function it implements.
Most of. NET's features-garbage collection, version control, thread management, and so on, all use the services provided by CLR.

When you are. when the NET Framework compiles the source code, the target code is not a machine instruction that the CPU can recognize, but a kind of code called "Microsoft intermediate language (MSIL, or IL for short). CLR provides a real-time compiler,
It is used to compile the IL code into the local machine code. in this way, the CLR can make the code portable, because. NET application source code must be compiled into IL code, which can run on any platform that provides CLR services. from the perspective of CLR,
All languages are equal, as long as there is a compiler that can generate IL code, this ensures the interoperability of various languages.
Managed code-managed code

Code executed by the Common Language Runtime Library (CLR) Environment (rather than directly by the operating system. Hosted code applications can obtain the Common Language Runtime library service, such as automatic garbage collection, Runtime Library type check, and security support.
These services help provide unified managed code application behavior independent of platform and language.

Unmanaged Code-Unmanaged Code

Code that is directly executed by the operating system outside the public Language Runtime Library environment. The unmanaged code must provide its own services such as garbage collection, type check, and security support. Unlike the hosted code, the latter obtains these services from the public Language Runtime Library.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.