As prep for recent interviewing, I worked up this list of topics. I chose to keep in mind .NET 8 and .NET 9 as latest versions, as .NET 10 has not been fully released yet.

How'd I do? What topics have you been asked about in your Csharp .NET interviews and what was the position that you were interviewing for?


What You Should Know For a Csharp .NET Interview

What to Know for a C# .NET Interview: A Practical Guide

Whether you're preparing for your first .NET developer interview or brushing up for a senior role, it's essential to know both theoretical concepts and hands-on best practices. This post outlines key areas that interviewers commonly focus on, along with real-world explanations and code samples.


1. Entity Framework Core (EF Core)

Transactions and Concurrency

  • EF Core uses implicit transactions during SaveChanges() or SaveChangesAsync(). If any part fails, the whole change set is rolled back.
  • For multi-step or multi-context operations, use explicit transactions with BeginTransaction().
  • Concurrency is handled via optimistic concurrency. Use [Timestamp] or .IsRowVersion() to track changes and handle DbUpdateConcurrencyException when conflicts occur.

Best Practices

  • Structure user code in repository and unit of work patterns to allow testability.
  • Use LINQ for querying, and parameterization protects against SQL injection.
  • Transactions can be handled with BeginTransaction or TransactionScope, but be cautious with async flows.

2. Asynchronous Programming in .NET

How It Works

  • await suspends execution until the awaited task completes.
  • It builds a state machine under the hood to resume execution without blocking threads.

Key Concepts

  • Use ConfigureAwait(false) to avoid resuming on the original context (especially in libraries).
  • Use async Task, not async void, to allow proper exception handling and testability.

Collections for Async / Multi-threaded Use

  • ConcurrentDictionary, BlockingCollection, ImmutableList, Channel<T> for thread-safe operations.

3. C# Language Fundamentals

Class vs Struct

  • Classes are reference types (heap), structs are value types (stack).
  • Use structs for small, immutable data with no inheritance.

Abstract vs Virtual

  • abstract means no implementation and must be overridden.
  • virtual provides a default that can be overridden.

Generics

  • Enable type-safe reusable code: List<T>, Func<T>, Action<T>.
  • Support constraints: where T : class, new(), etc.

Dynamic vs Object

  • object: compile-time type checking.
  • dynamic: runtime resolution (lose IntelliSense and safety).

4. Design Patterns and Testing

Dependency Injection

  • Promotes loose coupling, testability, and separation of concerns.
  • Configure services in Startup.cs or using .AddScoped(), .AddSingleton(), etc.

Mocking

  • Used in unit tests to simulate external dependencies.
  • Libraries: Moq, NSubstitute.
  • Mock IService methods to test business logic in isolation.

Writing Testable Code

  • Favor interfaces and DI.
  • Avoid static or tightly coupled dependencies.
  • Use clear layering: Controller -> Service -> Repository.

5. SQL and Database Concepts

Cursors

  • DBAs prefer to avoid them: they're slow and procedural.
  • Use set-based operations (joins, CTEs) instead.

Indexes

  • Primary Key vs Clustered Index:

    • PK: enforces uniqueness.
    • Clustered: defines physical order.
  • Non-clustered index: separate structure for quick lookups.

  • You can have multi-column PKs and clustered indexes.

Stored Procedures & Transactions

  • In SQL Server, nested transactions aren’t truly independent.
  • A ROLLBACK anywhere will roll back the entire outer transaction unless savepoints are used.

6. Frontend and Web Development Topics

SPA (Single Page Applications)

  • Frameworks like Blazor, React, Svelte.
  • Pros: fast navigation, richer UX.
  • Cons: SEO, initial load size.

Async in Svelte

<script>
  import { onMount } from 'svelte';
  let data;
  onMount(async () => {
    const res = await fetch('/api/data');
    data = await res.json();
  });
</script>
Enter fullscreen mode Exit fullscreen mode

Testing Layers

  • Frontend: Unit tests, UI tests (e.g., Playwright).
  • Backend: Unit tests, integration tests.
  • Use mocking and DI to isolate.

7. Collections and LINQ

System.Collections.Generic

  • List<T>, Dictionary<K,V>, HashSet<T>, etc.
  • Collections tailored for performance, memory use.

System.Linq

  • Enables querying objects (.Where, .Select, .FirstOrDefault).
  • IEnumerable vs IQueryable: deferred vs translated execution.

8. .NET Ecosystem Overview

Languages

  • C#, F#, VB.NET (mainly C# now).

Frameworks

  • ASP.NET Core (Web APIs, MVC, Blazor)
  • MAUI (cross-platform apps)
  • Azure Functions (serverless)

.NET 8/9 Highlights

  • .NET 8: Native AOT, improved performance, better Blazor unification.
  • .NET 9: More performance tuning, tooling improvements.

Final Thoughts

These topics cover both conceptual knowledge and hands-on fluency expected in a modern .NET interview. By focusing on understanding why things work the way they do instead of how, you'll be better prepared to tackle technical questions, coding exercises, and design discussions.