C# Interview Question #4

What is managed code?

C# & .NET Fundamentals Junior Beginner

Quick Interview Answer

Managed code is code that executes under the control of the .NET CLR. The runtime manages important services such as memory allocation, garbage collection, exception handling, type checking, and thread management.

Detailed Explanation

Managed code is code that executes under the control of the .NET CLR. The runtime manages important services such as memory allocation, garbage collection, exception handling, type checking, and thread management.

Most normal C# application code is managed code. Code executed outside the CLR, such as some native C or C++ libraries, is generally called unmanaged code.

Code Example

string name = "Asif";
int age = 30;