Difference between Managed and Unmanaged code in .NET
Managed code is the code which is managed by the CLR(Common Language Runtime) in .NET Framework. Whereas the Unmanaged code is the code which is directly executed by the operating system. Below are some important differences between the Managed code and Unmanaged code:
| Managed Code | Unmanaged Code |
|---|---|
| It is executed by managed runtime environment or managed by the CLR. | It is executed directly by the operating system. |
| It provides security to the application written in .NET Framework. | It does not provide any security to the application. |
| Memory buffer overflow does not occur. | Memory buffer overflow may occur. |
| It provide runtime services like Garbage Collection, exception handling, etc. | It does not provide runtime services like Garbage Collection, exception handling, etc. |
| The source code is complied in the intermideate language know as IL or MSIL or CIL. | The source code direclty compile into native langugae. |
| It does not provide low-level access to the prgrammer. | It provide low-level access to the prgrammer. |
Recommended Posts:
- Managed code and Unmanaged code in .NET
- C# | Getting the unique identifier for the current managed thread
- C# | Check if a thread belongs to managed thread pool or not
- Unsafe Code in C#
- C# | How to get hash code for the specified key of a Hashtable
- Getting the hash code of the ValueTuple in C#
- Code valid in both C and C++ but produce different output
- Web 1.0, Web 2.0 and Web 3.0 with their difference
- Difference between TDM and FDM
- Difference between CLI and GUI
- Difference between LAN and WAN
- Difference between LAN, MAN and WAN
- Difference between CRT and LCD
- Difference between 1G and 2G
- Difference Between BFS and DFS
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



