</> realdeveloper

CLR: what runs C# code?

The Common Language Runtime manages execution of .NET code, providing services such as memory management, type safety and exception handling. C#, .NET libraries and the CLR have different responsibilities.

A concrete example

Garbage collection can reclaim an unreachable object’s memory. Timely cleanup of files or database connections still requires mechanisms such as IDisposable and using.

using var connection = new SqliteConnection(path);

Explain it yourself

Why dispose a connection when garbage collection exists?

How to study this

Write your reasoning first. Check the original documentation, identify an assumption, then try a different example. Reading this page does not count as verified skill evidence.

Source and review

Microsoft CLR ↗

Original RealDeveloper explanation; last source check: .

Put it into practice

Public pages are open to everyone. Sign in to save answers and follow a personal practice route.

Open practice topics →