3
Reply

what is the difference between managed code and non managed code?

Mallika

Mallika

14y
5.9k
0
Reply

    Mike Gold has already answered the question.I would like to add a point to it.

    Code that is executed by CLR is the managed code whereas the code that is not executed by CLR is the unmanaged code.
    Whereas we can have both managed and unmanaged code in C#. Pointers fall under the category of unmanaged code.

    Managed code as stated runs behind the CLR (Common Language Runtime).  The code is called managed code because the objects created inside the application domain are "managed". In other words,  they are garbage collected when they fall out of scope or when they need to be collected by the CLR.  This means that the memory that the objects occupy is managed behind the seens.  When the object is created the memory is allocated.   When the object is garbage collected by the CLR, the memory is freed up.  Managed code frees the user up from having to deal with these issues. In unmanaged code, you need to do your own memory management when creating objects on the heap.   C#, F# and VB.NET are languages that run behind Managed Code.  IronPython and IronRuby do as well.  Visual C++ allows you to run in mixed mode with both managed and unmanaged code running in your application.

    also see http://en.wikipedia.org/wiki/Managed_code

    managed code runs under the clr control where as unmanaged code runs as ordinary program os take care on that code