Skip to content
CompanyBenchCompanyBench

.NET interview questions and answers

C# and .NET interview questions with clear answers on ASP.NET Core, Entity Framework, LINQ, garbage collection, boxing, async/await and middleware.

Key questions for .NET interviews at intermediate to advanced level, covering C#, ASP.NET Core, Entity Framework, LINQ and memory management. Allow 40-50 minutes to go through them.

C# language

What are the key features of C#?

Object-oriented programming, strong type checking, automatic garbage collection, LINQ, async/await and structured exception handling.

What is the difference between value types and reference types?

Value types (structs, enums) hold their data directly, usually on the stack. Reference types (classes, arrays) hold a reference to data on the heap.

What are boxing and unboxing?

Boxing converts a value type to a reference type (object). Unboxing converts it back. Boxing has a performance cost because it allocates on the heap.

What is the purpose of the using statement?

It makes sure an IDisposable object is disposed of correctly, even if an exception is thrown. It is shorthand for a try/finally block.

How do async and await work?

They simplify asynchronous code. async marks a method that returns Task or Task<T>. await pauses that method until the awaited task completes, without blocking the thread.

Runtime and data

How does garbage collection work in .NET?

The runtime manages memory automatically. It tracks object references and reclaims memory from objects that are no longer reachable.

What is LINQ and what are its benefits?

Language Integrated Query lets you query collections with syntax built into C#. It makes code easier to read and cuts boilerplate query code.

What is Entity Framework and how does it work?

Entity Framework is an ORM. It lets .NET developers work with a database through .NET objects, removing most hand-written data-access code.

ASP.NET

What is the difference between ASP.NET MVC and ASP.NET Core?

ASP.NET Core is a cross-platform, high-performance rewrite of ASP.NET MVC, with a modular architecture and built-in dependency injection.

What is middleware in ASP.NET Core?

Components that handle requests and responses, arranged in a pipeline. Each one can pass the request to the next or short-circuit the pipeline.

Hiring for .NET? See .NET developers on contract or browse remote .NET developer jobs.