What is "managed" \ how to interact with non-managed code?

Source: Internet
Author: User

Term "hosting ("Managed)" is the cause of many chaos. In. net, it is used in many different places, and there are slight differences in what is expressed.

ManagedCode(Managed code ):.Net framewor isProgramProvides several core runtime services, such as exception handling and security. To make these services work, the Code must provide the minimum information to the runtime. Such code is called managed code. By default, all C # and Visual Basic. Net code are hosted. By default, vs7 C ++ code is not hosted. However, you can specify the command line switch (/COM +) to enable the compiler to generate managed code.

Managed Data (Managed Data ):The data is configured and cleared by the. NET runtime garbage collector. C # and VB. NET data is always hosted. By default, vs7 C ++ data is not hosted, even if/COM + is used, however, you can use the _ GC keyword to mark it as hosted.

Managed classes (Managed classes ):This term is usually mentioned in the context of C ++ managed extensions for C ++. When me C ++ is used, the category can be marked with the _ GC keyword. As the name implies, this means that the memory occupied by the entity of this class is managed by the garbage collector, but it means not only that. This class has become a member that is fully delivered to the. NET family. It can enjoy the benefits of. NET and is also restricted by. net. An example of the benefits is that it can interwork well with classes written in other languages. For example, a managed C ++ class can inherit from a VB class. One example of constraints is that a Managed class can only inherit from one base class.

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.