Interview questionsUpdated 12 Oct 2026 · Team InterviewPlan

.NET Developer Interview Questions and Answers

.NET developer interviews test C# depth, ASP.NET Core architecture and data access with Entity Framework Core, often with Azure in the mix. These questions reflect what .NET candidates are asked in 2026 at enterprises, consulting firms and product companies, with model answers drawn from real project situations.

What interviewers test in a .NET developer interview

Loops typically include a C# fundamentals round, an ASP.NET Core and API round, a database and EF Core discussion, and a coding exercise. Senior roles add architecture questions such as clean architecture, CQRS and microservices on Azure.

Interviewers check whether you understand what the framework does for you, for example what a scoped lifetime means for a DbContext in a web request.

  • C#: types, generics, delegates, events, records and pattern matching
  • Async: Task, async and await, deadlocks and cancellation
  • ASP.NET Core: middleware pipeline, routing, filters and configuration
  • Data: EF Core, LINQ, transactions and performance
  • Quality and cloud: testing, logging, Azure App Service and Functions

Technical topics to revise

Build a small ASP.NET Core Web API on .NET 8 or later with EF Core, dependency injection and xUnit tests. Explaining the Program.cs of your own project covers many common questions.

  • Value and reference types, boxing, structs and records
  • async and await, ConfigureAwait, CancellationToken and Task.WhenAll
  • LINQ deferred execution, IEnumerable versus IQueryable
  • Transient, scoped and singleton lifetimes and captive dependencies
  • Middleware order, authentication with JWT and authorisation policies
  • EF Core: AsNoTracking, Include, migrations and raw SQL
  • IDisposable, using declarations and garbage collection generations
  • xUnit, Moq or NSubstitute, and WebApplicationFactory integration tests

How to structure your answers

For C# concepts, give a short definition, then a scenario where it matters, such as a captive dependency bug or a LINQ query that pulled a whole table into memory.

For project stories, describe the architecture briefly, your contribution and a measurable outcome like reduced API latency or fewer production incidents.

How InterviewPlan AI helps you prepare

Practise .NET mock interviews covering C#, ASP.NET Core and EF Core with feedback on depth. Coding help supports practice tasks, and Resume AI sharpens your project bullets.

Interview Copilot runs as a Windows or macOS desktop app with speaker-labelled transcription and resume-grounded answer drafts in under a second. After you join, .NET Job Support gives live expert-plus-AI help in your first 90 days. Both are $5 per hour with 200 AI credits included.

Questions and model answers

9 questions you are likely to hear.

  1. What is the difference between IEnumerable and IQueryable?

    Why they ask: This is a very common question because the wrong choice can load entire tables into memory.

    Sample answer: IEnumerable works with in-memory collections and executes LINQ operations in .NET code. IQueryable builds an expression tree that a provider like EF Core translates into SQL, so filters run in the database. If I call a method that returns IEnumerable from a DbSet and then add Where, the filter may run in memory after loading every row. I once found a repository method returning IEnumerable for a customers table with over a million rows; changing it to IQueryable and filtering before materialising cut the endpoint's response time from seconds to milliseconds.

  2. Explain dependency injection lifetimes in ASP.NET Core.

    Why they ask: Lifetime mistakes cause hard-to-find bugs, especially with DbContext.

    Sample answer: Transient services are created every time they are requested, scoped services once per HTTP request, and singletons once for the application's lifetime. DbContext is registered as scoped because it is not thread-safe and should live for one unit of work. The classic bug is a captive dependency: injecting a scoped service into a singleton, which keeps one DbContext alive across requests and causes concurrency errors and stale data. ASP.NET Core can validate scopes in development to catch this. When I need scoped services in a background service, I create a scope with IServiceScopeFactory.

  3. How does async and await work, and what causes deadlocks?

    Why they ask: Async is central to scalable .NET services and often misused.

    Sample answer: async and await let a method yield its thread while waiting on I/O, so the thread can serve other requests, and continue when the task completes. The compiler builds a state machine for this. Deadlocks happen mostly in older ASP.NET or UI apps with a synchronisation context when code blocks on async work with .Result or .Wait. ASP.NET Core has no synchronisation context, but blocking still wastes threads and can cause thread pool starvation. I keep code async all the way down and pass CancellationToken. Removing .Result calls in one API fixed timeouts that appeared only under load.

  4. How does the ASP.NET Core middleware pipeline work?

    Why they ask: Interviewers check understanding of request processing and ordering.

    Sample answer: Each middleware component receives the HttpContext, can do work before and after calling the next component, or short-circuit the pipeline. Order matters: exception handling should be first so it catches errors from later components, then HTTPS redirection, static files, routing, authentication, authorisation and finally endpoints. If authorisation is placed before authentication, user identity is not available and requests fail. I have written custom middleware for correlation IDs, adding an ID to each request and to log scopes, which made tracing issues across services much easier.

  5. How do you improve Entity Framework Core performance?

    Why they ask: EF Core performance issues are common in production .NET apps.

    Sample answer: I start by logging generated SQL to see what actually runs. For read-only queries I use AsNoTracking to skip change tracking. I project to DTOs with Select so only needed columns are loaded, and use Include carefully to avoid N+1 queries or huge joins, sometimes with AsSplitQuery. I add indexes for frequent filters through migrations. For bulk updates I use ExecuteUpdate and ExecuteDelete in EF Core 7 and later instead of loading entities. On a reporting endpoint, projections and AsNoTracking reduced memory use and cut response time by about two thirds.

  6. What is the difference between an interface and an abstract class in C#?

    Why they ask: A fundamentals check that also reveals design thinking.

    Sample answer: An interface defines a contract that a class implements, and a class can implement many interfaces. Since C# 8, interfaces can have default implementations, but they cannot hold instance state. An abstract class can have fields, constructors and partially implemented behaviour, but a class can inherit only one. I use interfaces for dependencies I want to swap or mock, like IEmailSender or IPaymentGateway, and abstract classes when related types share real state and logic, such as a base report generator with common formatting. Most of my DI-based code relies on interfaces for testability.

  7. How do you secure an ASP.NET Core Web API?

    Why they ask: Security is a core responsibility for backend developers.

    Sample answer: I use JWT bearer authentication, often with Microsoft Entra ID or another identity provider, and define authorisation policies based on roles or claims rather than checking roles inline. I enforce HTTPS, validate all input with data annotations or FluentValidation, and use parameterised queries through EF Core to avoid SQL injection. Secrets go into Azure Key Vault, not appsettings. I configure CORS with an explicit allowlist and add rate limiting with the built-in middleware. I also check resource ownership in handlers, so one user cannot access another user's data by changing an ID.

  8. How do you write tests for an ASP.NET Core API?

    Why they ask: Testing practices show code quality and maturity.

    Sample answer: I write unit tests with xUnit for services and domain logic, mocking dependencies with Moq or NSubstitute. For APIs, I use WebApplicationFactory to spin up the app in memory and call endpoints with HttpClient, replacing external services with fakes. For database behaviour I prefer Testcontainers with a real SQL Server or PostgreSQL instance over the EF in-memory provider, because the in-memory provider does not behave like a relational database. Tests run in Azure DevOps or GitHub Actions on every pull request. This caught several migration issues before they reached staging.

  9. Tell me about a .NET project where you improved performance or reliability.

    Why they ask: This reveals ownership and real-world impact.

    Sample answer: In an insurance claims system on .NET 6, the nightly batch to process claims took about five hours and sometimes overlapped with business hours. I profiled it with dotTrace and found it processed claims one by one with a separate database round trip per rule. I rewrote it to load data in batches, used Parallel.ForEachAsync with a limited degree of parallelism, and moved bulk updates to ExecuteUpdate after upgrading to .NET 8. The job dropped to under an hour, and the operations team stopped receiving morning escalations.

FAQ

Questions people ask about .net developer.

Which .NET version should I prepare for?

Prepare for .NET 8 or later, which most teams use in 2026, and be ready to talk about migrating from .NET Framework. Know minimal APIs, the generic host, built-in DI and the main C# 12 features.

Do .NET interviews include Azure questions?

Often, yes. Common topics are App Service, Azure Functions, Azure SQL, Service Bus, Key Vault and Application Insights. Even if the role is not cloud-focused, know how your app is deployed and monitored.

Are .NET interviews heavy on coding?

Most include at least one coding exercise in C#, such as string manipulation, collections or LINQ. Product companies may add data structures and algorithms. Practise writing clean C# without relying on IDE autocomplete.

Is .NET Job Support available after I get hired?

Yes. InterviewPlan AI's .NET Job Support provides live expert-plus-AI help in your first 90 days with tickets, code reviews and stand-ups. It costs $5 per hour, taxes included, and hours never expire.

P.S.

Reading helps. Practising out loud helps more.

Start free with 5 live minutes and 100 AI credits for Resume AI, Job Search, Auto-Apply, mock interviews and Behavioral Coach.