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.