Home > Interview Questions > .Net Framework > What is managed and unmanaged code in .net?

What is managed and unmanaged code in .net?

by Thamil   on 01/10/2015   Category: .Net Framework   |  Level: Intermediate   |  Views: 636    |  Points: 25     |  Gold 

Managed code:

• The code which executes under the CLR environment called as managed code. I.e. C#.Net, VB.Net, F#.Net etc
• Shortly we can say all intermediate languages (IL) are managed code.
• CLR provides the below services for the managed code
-Automatic memory management (Memory allocation and release)
-Type checking
-Exception handling
-Code security
-Thread support
-Type check
-Debug support

Unmanaged code:

• Unmanaged code is code that is not run under .Net framework and it’s compiled to machine code, directly executed by operating system.
• VB, COM components, Win32 API, C and C++ etc codes are examples of unmanaged code.
• Does not provide the services memory management, type check, so all these needs to be taken by the programmer while coding when you use unmanaged code.
• It is not type safe and unmanaged code would impact the reliability of your application.
• Unmanaged code does not support the versioning, so when we use unmanaged code in .net we can’t use different versions of unmanaged code in same assembly.

« What is difference between method overloading and overriding in C#?
» What is the entry point for C# console application?
Post Question  |  Question Home

Recent Posts

User Responses

No response found, be the first to review this question.

Submit feedback about this code snippet

Please sign in to post feedback

Latest Posts