What is Managed Code in .NET?Managed code
is the code that is eligible for execution by CLR.
There are two circumstances when your code is not managed. They are listed below: " If you use third party components in your system, CLR will not execute the source code of the corresponding language in which the component is built. Hence they are unmanaged. " In your normal coding you do not access memory directly and CLR does the complete memory management for you. But there are certain circumstances when you want to access memory directly. In such cases you will use pointers inside unsafe code block. These unsafe code blocks are allocated in stack and not in heap. Hence these unsafe code blocks are not managed by CLR and they become unmanaged code. All other
source code that doesn't fit into the above mentioned two cases becomes
managed code. Managed codes are stored in the heap memory and they are
processed by the CLR. Moreover memory management for such codes is automatically
done by the CLR.
|