Generics, delegates and events, LINQ, advanced and modern C# 14 language features, and memory-oriented C# (spans, ref types, pooling) for .NET 10 engineers.
-
Which LINQ operators cause immediate execution, and how do you choose between ToList, ToArray, ToDictionary, ToHashSet, ToLookup and the async versions? Explain the cost of each, single-item operators like First, Single and Any, and how to materialise efficiently.
Immediate execution in LINQ: scalar and collection operators, First versus Single versus Any, choosing the right materialisation, async materialisation in EF Core, and allocation costs.
Junior
Theory
LINQ
Β· π 2 follow-ups
-
What is IEnumerable<T> really? Explain the IEnumerable/IEnumerator contract, how foreach is compiled (including the pattern-based GetEnumerator and struct enumerators), enumerator disposal, IAsyncEnumerable<T>, and when a method should accept or return IEnumerable<T>.
IEnumerable<T> and IEnumerator<T> in depth: the contract, foreach lowering, struct enumerators and boxing, disposal, async streams, and API design guidance on accepting and returning sequences.
Mid-Level
Theory
LINQ
Β· π 3 follow-ups Β· π 1 real-world
-
What is IQueryable<T>, and how is it different from IEnumerable<T>? Explain Expression, ElementType and Provider, how Queryable methods build expression trees, why the static type of a variable decides where a query runs, AsEnumerable and AsQueryable, and whether a repository should expose IQueryable.
IQueryable<T>: the provider model, Queryable versus Enumerable overload binding, crossing between database and memory with AsEnumerable, and the design debate about exposing IQueryable.
Senior
Theory
LINQ
Β· π 3 follow-ups Β· π 1 real-world
-
What are expression trees in C#? Explain how the compiler turns a lambda into an Expression<TDelegate>, how to build, inspect and compile expression trees at run time, how LINQ providers and libraries use them, what C# features cannot appear in them, and the performance and AOT costs of Compile().
Expression trees: code as data, compiler-generated trees from lambdas, building and visiting trees, combining predicates, Compile cost and caching, interpretation under Native AOT, and language limitations.
Senior
Coding
LINQ
Β· π 2 follow-ups Β· π 1 real-world
-
Code review: this order-reporting code mixes EF Core and LINQ to Objects. It calls ToList() before Where, uses Count() > 0, calls FirstOrDefault on a list inside a loop, does OrderBy().First(), enumerates the same query several times, loads related data inside a foreach, and builds IN lists with Contains over 50,000 ids. Find the LINQ performance mistakes and rewrite it.
A code review of the most common LINQ performance mistakes in .NET 10 services, in memory and against EF Core, with the reasoning and the rewrite for each.
Senior
CodeReview
LINQ
Β· π 3 follow-ups Β· π 1 real-world
-
How are extension methods resolved and when should you use them? Explain how the compiler binds them, why instance methods always win, null receivers, ref extension methods on structs, the C# 14 extension block syntax for extension properties and static members, and the design mistakes extension methods invite.
Extension methods beyond the basics: binding and precedence rules, namespace scoping, null receivers, ref this for structs, C# 14 extension members, and good versus bad uses.
Mid-Level
Theory
Advanced Language Features
Β· π 3 follow-ups Β· π 1 real-world
-
What are anonymous types in C#? Explain what the compiler generates, how equality and immutability work, why == behaves differently from Equals, when two anonymous types share a type, their use in LINQ projections and EF Core, and their limits compared with tuples and records.
Anonymous types: compiler-generated internal classes, value equality via Equals but reference equality via ==, type unification, with-expressions, LINQ and EF Core projections, and when to switch to records or tuples.
Junior
Theory
Advanced Language Features
Β· π 2 follow-ups
-
How do tuples work in C#? Explain System.ValueTuple versus System.Tuple, element names and why they disappear at run time, tuple equality, mutability, performance, serialisation pitfalls, and when you should use a record instead.
C# tuples: ValueTuple internals, compile-time names via TupleElementNames, equality, mutable fields, boxing and size, JSON serialisation gotchas, and choosing tuples versus records.
Mid-Level
Theory
Advanced Language Features
Β· π 3 follow-ups Β· π 1 real-world
-
What is deconstruction in C#? Explain how var (a, b) = x works for tuples, records and any type with a Deconstruct method (including extension Deconstruct), discards, deconstruction in foreach and LINQ, mixed declaration and assignment, and how deconstruction relates to positional patterns.
Deconstruction: tuple and Deconstruct-based unpacking, extension Deconstruct for types you do not own, discards, foreach over dictionaries, C# 10 mixed forms, and the link to positional patterns.
Junior
Theory
Advanced Language Features
Β· π 3 follow-ups
-
What kinds of pattern matching does C# 14 support? Explain type, constant, relational, logical, property (including extended property), positional, var, discard and list patterns, how the compiler checks exhaustiveness and subsumption, and when pattern matching is better or worse than polymorphism.
The full C# pattern language: every pattern kind with its version, how patterns compose, compiler exhaustiveness and subsumption checks, performance of the generated decision tree, and design trade-offs versus virtual methods.
Mid-Level
Theory
Advanced Language Features
Β· π 3 follow-ups Β· π 1 real-world
-
How do switch expressions differ from switch statements in C#? Explain arms, guards, discards, target typing of the result, exhaustiveness and SwitchExpressionException, tuple switches for state machines, and when a switch expression is the wrong tool.
Switch expressions in depth: syntax and semantics versus switch statements, when clauses, natural and target typing, exhaustiveness checking, tuple-based state machines and readability trade-offs.
Mid-Level
Coding
Advanced Language Features
Β· π 2 follow-ups Β· π 1 real-world
-
A colleague wrote an iterator method and an async method that validate their arguments, but ArgumentNullException is only thrown when the result is enumerated or awaited, far from the bad call. Why does this happen, and how do local functions fix it? Also explain static local functions and when to prefer a local function over a lambda or private method.
Local functions in practice: eager validation for iterators and async methods, capture without allocation, static local functions, recursion, and choosing between local functions, lambdas and private methods.
Mid-Level
Debugging
Advanced Language Features
Β· π 3 follow-ups Β· π 1 real-world
-
How do iterators work in C#? Explain yield return and yield break, what state machine the compiler generates, lazy evaluation, how try/finally and using behave inside iterators, the restrictions on iterator methods, async iterators, and the performance trade-offs of yield.
Iterators: yield return and yield break semantics, compiler-generated state machines, disposal and finally, restrictions (no ref params, no yield in catch), async iterators, and cost versus materialised collections.
Mid-Level
Theory
Advanced Language Features
Β· π 3 follow-ups Β· π 1 real-world
-
What are closures in C#? Explain how captured variables are hoisted into a compiler-generated class, why capture is by variable rather than by value, the for-loop versus foreach capture difference, closures in async code and timers, the allocation and memory-leak risks, and how static lambdas help.
Closures in C#: display classes, capture by variable, loop capture rules since C# 5, shared closure scopes, async and long-lived closures, allocation costs and leaks, and mitigation with static lambdas and state arguments.
Mid-Level
Debugging
Advanced Language Features
Β· π 3 follow-ups Β· π 1 real-world
-
How does reflection work in .NET and what does it cost? Explain Type, MemberInfo and BindingFlags, why MethodInfo.Invoke is slow, how to make reflection fast (cached delegates, MethodInvoker in .NET 8, UnsafeAccessor), and why reflection breaks trimming and Native AOT unless you annotate it.
Reflection APIs, their run-time cost, faster alternatives in .NET 8+, and trimming/AOT annotations.
Senior
Theory
Advanced Language Features
Β· π 3 follow-ups Β· π 1 real-world
-
How do attributes work in C#? Explain what the compiler stores in metadata, when attribute instances are actually created, AttributeUsage (targets, AllowMultiple, Inherited), allowed argument types, generic attributes (C# 11), attributes the compiler itself acts on, and caller information attributes including CallerArgumentExpression.
Attributes as metadata, custom attribute design, generic attributes, compiler-interpreted attributes and caller info attributes.
Mid-Level
Theory
Advanced Language Features
Β· π 3 follow-ups Β· π 1 real-world
-
As a consumer, how do you use the source generators that ship with .NET 10? Explain what a source generator can and cannot do, and walk through System.Text.Json source generation, GeneratedRegex, LoggerMessage, LibraryImport, the configuration binding and Request Delegate generators, and how to inspect and debug the generated code.
Using built-in .NET source generators for performance, trimming and Native AOT, and inspecting generated code.
Mid-Level
Theory
Advanced Language Features
Β· π 3 follow-ups Β· π 1 real-world
-
What are Roslyn analysers and how do you use them to enforce rules in a team? Explain the compiler-as-a-platform idea (syntax trees, semantic model, operations), how built-in .NET analysers and code style rules are configured, BannedApiAnalyzers, and walk through writing and packaging a small custom DiagnosticAnalyzer.
Roslyn analysers in practice: configuration, banned APIs, and a minimal custom DiagnosticAnalyzer.
Senior
Theory
Advanced Language Features
Β· π 3 follow-ups Β· π 1 real-world
-
Review this code from a project that has just enabled nullable reference types: it is full of `!` operators, `= default!` on properties, and helper methods like TryGetCustomer that the compiler does not understand. What is wrong, and how do you make nullable annotations actually protect you? Cover the nullable attributes, generics with T?, EF Core and deserialisation.
Advanced nullable reference types: code review of common misuse, nullable attributes, generics and framework boundaries.
Mid-Level
CodeReview
Modern C#
Β· π 3 follow-ups Β· π 1 real-world
-
How do init and required work together in C#? Explain init-only setters (C# 9), required members (C# 11), what the compiler enforces, SetsRequiredMembers, how they interact with constructors, object initialisers, with expressions and System.Text.Json, and when you would choose a constructor instead.
init-only setters and required members: object initialisation contracts, constructors, with expressions and deserialisation.
Mid-Level
Theory
Modern C#
Β· π 3 follow-ups Β· π 1 real-world