What is Managed and Unmanaged code?

 Posted by Poster on 5/22/2008 | Category: .NET Framework Interview questions | Views: 4865

Managed Code is what Visual Basic .NET and C# compilers create. It compiles to Intermediate Language (IL), not to machine code that could run directly on your computer. The IL is kept in a file called an assembly, along with metadata that describes the classes, methods, and attributes (such as security requirements) of the code you've created. This assembly is the one-stop-shopping unit of deployment in the .NET world. You copy it to another server to deploy the assembly there—and often that copying is the only step required in the deployment.

Unmanaged code is what you use to make before Visual Studio .NET 2002 was released. Visual Basic 6, Visual C++ 6, heck, even that 15-year old C compiler you may still have kicking around on your hard drive all produced unmanaged code. It compiled directly to machine code that ran on the machine where you compiled it—and on other machines as long as they had the same chip, or nearly the same. It didn't get services such as security or memory management from an invisible runtime; it got them from the operating system. And importantly, it got them from the operating system explicitly, by asking for them, usually by calling an API provided in the Windows SDK. More recent unmanaged applications got operating system services through COM calls.

For more, see http://www.codeguru.com/columns/Kate/article.php/c4871/

Source: http://www.codeguru.com/columns/Kate/article.php/c4871/ | Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Posted by: Vivekjj on: 10/5/2012 | Points: 10
under CLR managing code is managed code otherwise it is unmanaged code

Login to post response