What is managed code and managed data?

Managed code is the code that is written to target the services of the Common Language Runtime (CLR). In order to target these services, the code must provide a minimum level of information to the runtime. All of the C#, Visual Basic .NET and J# .NET code is managed by default.

Closely related to managed code is managed data. This is the data that is allocated and de-allocated by the Common Language Runtime's garbage collector. As said earlier C#, Visual Basic, and J#.NET data is managed by default. C++ data can, however, be marked as unmanaged through the use of special keywords. Visual Studio .NET C++ data is unmanaged by default (even when using the /CLR switch), but when using Managed Extensions for C++, a class can be marked as managed by using the __gc keyword.

As the name suggests this means that the memory used for instances of the class is managed by the garbage collector. In addition the class becomes a full participating member of the .NET Framework with the benefits and restrictions that it brings. An example of a benefit is proper interoperability with classes written in other languages (for example, a managed C++ class can inherit from a Visual Basic class).

An example of a restriction is that a managed class can only inherit from one base class.

Written by Sandeep Mogulla, Webmaster at www.startvbdotnet.com

Index
 

Other Views

corner

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.