Generics, delegates and events, LINQ, advanced and modern C# 14 language features, and memory-oriented C# (spans, ref types, pooling) for .NET 10 engineers.
-
How do you use records well in production C#? Explain what the compiler generates for a record class (equality, EqualityContract, ToString, Deconstruct, copy constructor), how inheritance affects equality, why with is a shallow copy, the collection-equality trap, and where records fit or do not fit (DTOs, value objects, EF Core entities).
Practical record class usage: generated members, inheritance, with expressions, collection equality and EF Core fit.
Mid-Level
Theory
Modern C#
Β· π 3 follow-ups Β· π 1 real-world
-
What is a record struct in C# 10, and how does it differ from a record class and a plain struct? Explain readonly record struct, the mutability default, generated equality versus ValueType.Equals, with expressions on structs, the default value problem, and when a record struct is the right choice.
record struct and readonly record struct: semantics, equality performance, default values and when to choose them.
Mid-Level
Theory
Modern C#
Β· π 3 follow-ups Β· π 1 real-world
-
How do primary constructors on classes and structs (C# 12) differ from those on records? Explain parameter capture, why parameters are not properties, the double-storage warning CS9124, mutation of captured parameters, validation, use with dependency injection, and the pitfalls you would flag in review.
C# 12 primary constructors for classes and structs: capture semantics, warnings, DI usage and review pitfalls.
Mid-Level
CodeReview
Modern C#
Β· π 3 follow-ups Β· π 1 real-world
-
What are file-scoped namespaces, global using directives and implicit usings in modern C#? Explain how each works, where to put global usings, how ImplicitUsings and the Using MSBuild item generate them, global using static and alias directives (including C# 12 alias any type), and the problems they can cause in large solutions.
File-scoped namespaces (C# 10), global usings, implicit usings and using aliases in modern projects.
Junior
Theory
Modern C#
Β· π 2 follow-ups
-
What are raw string literals in C# 11? Explain the triple-quote syntax, how indentation is removed, including quotes inside the text, interpolated raw strings with multiple dollar signs, UTF-8 raw strings, and where they help in real code such as JSON, SQL and test fixtures.
Raw string literals: syntax, indentation rules, interpolation with $$ and practical uses.
Junior
Theory
Modern C#
Β· π 2 follow-ups
-
What are collection expressions in C# 12? Explain the [a, b, ..c] syntax, which target types they support (arrays, spans, lists, interfaces, CollectionBuilder types), why they have no natural type, how the compiler chooses an efficient implementation, the spread operator, and the performance and API design implications.
Collection expressions: syntax, target typing, CollectionBuilder, spread and performance behaviour.
Mid-Level
Theory
Modern C#
Β· π 3 follow-ups Β· π 1 real-world
-
How do list patterns work in C# 11? Explain matching on length and elements, the discard and slice patterns, capturing a slice with .. var rest, which types support list patterns (countable and indexable, plus slicing support), the allocation cost of slices for arrays, lists, strings and spans, and real uses such as command parsing.
List patterns: syntax, slice patterns, type requirements, slice costs and practical uses.
Mid-Level
Coding
Modern C#
Β· π 3 follow-ups Β· π 1 real-world
-
What are interceptors in C#, and what should a .NET developer know about them? Explain what problem they solve, how a source generator uses InterceptsLocation to redirect a specific call site, the InterceptorsNamespaces opt-in, where .NET already uses them (Request Delegate Generator, configuration binding generator), and why you should not hand-write them.
Awareness of interceptors: purpose, mechanics, opt-in, built-in uses and limits.
Senior
Theory
Modern C#
Β· π 3 follow-ups Β· π 1 real-world
-
Write generic numeric code in C# using static abstract interface members and generic math (.NET 7+). Explain INumber<T> and the smaller interfaces, T.Zero and T.CreateChecked, IParsable<T>, how to make your own type participate (operators as static abstract members, the self-referencing constraint), checked operators, and the performance and design trade-offs.
Generic math with static abstract interface members: writing and consuming numeric generic code.
Senior
Coding
Modern C#
Β· π 3 follow-ups Β· π 1 real-world
-
What is `Span<T>` and how do you use it to write allocation-free code? Explain what a span points to (arrays, stack memory, native memory), slicing, why it is a ref struct and what that forbids, MemoryExtensions helpers, CollectionsMarshal.AsSpan, and the performance gains and risks.
Span<T> in depth: what it can point to, slicing, ref struct limits, helper APIs and performance.
Mid-Level
Coding
Memory-Oriented C#
Β· π 3 follow-ups Β· π 1 real-world
-
When should you use `ReadOnlySpan<T>` instead of `Span<T>`, and what modern features build on it? Explain read-only views over strings and constant data, u8 literals, static ReadOnlySpan properties backed by assembly data, SearchValues, overload preference, and the C# 14 first-class span conversions.
ReadOnlySpan<T>: read-only views, constant data, u8 literals, SearchValues and C# 14 span conversions.
Mid-Level
Theory
Memory-Oriented C#
Β· π 3 follow-ups Β· π 1 real-world
-
What are `Memory<T>` and `ReadOnlyMemory<T>`, and how do they differ from spans? Explain why they can live on the heap and cross await, how .Span works, slicing, getting at the underlying array with MemoryMarshal.TryGetArray, ownership and lifetime rules, and how they appear in Stream, PipeReader and System.Text.Json APIs.
Memory<T>/ReadOnlyMemory<T>: heap-storable buffers for async code, ownership and API usage.
Mid-Level
Theory
Memory-Oriented C#
Β· π 3 follow-ups Β· π 1 real-world
-
Explain ref locals, ref returns and ref fields in C#. How do ref safety rules and the scoped keyword work, what does CollectionsMarshal.GetValueRefOrAddDefault give you, when do ref returns improve performance, and what bugs can references to storage cause?
ref locals, ref returns, ref fields (C# 11), scoped, ref safety and practical uses.
Senior
Theory
Memory-Oriented C#
Β· π 3 follow-ups Β· π 1 real-world
-
How do out parameters work in C#, and when should you use them? Explain definite assignment, out var and discards, the Try pattern, how out relates to ref under the hood, why async methods and iterators cannot have out parameters, nullable annotations for Try methods, and when a tuple or result type is a better choice.
out parameters: semantics, Try pattern, limits and alternatives such as tuples and result types.
Junior
Theory
Memory-Oriented C#
Β· π 3 follow-ups
-
What do `in` parameters and `ref readonly` parameters (C# 12) do? Explain passing large structs by readonly reference, hidden defensive copies with non-readonly structs, readonly members, when in makes code slower, the call-site rules for in and ref readonly, and how to decide between by-value, in and ref readonly.
in and ref readonly parameters: readonly references, defensive copies and when they help or hurt.
Senior
Theory
Memory-Oriented C#
Β· π 3 follow-ups Β· π 1 real-world
-
How do params work in modern C#, and what changed with C# 13 params collections? Explain params arrays and their hidden allocations, params ReadOnlySpan<T>, params IEnumerable<T> and List<T>, how overload resolution chooses between them, the new BCL overloads in .NET 9, and API design guidance.
params arrays versus C# 13 params collections, allocations, overload resolution and API design.
Mid-Level
Theory
Memory-Oriented C#
Β· π 3 follow-ups Β· π 1 real-world
-
What does readonly mean in each place it can appear in C#? Explain readonly fields, static readonly versus const (and the versioning trap), readonly structs, readonly members, readonly ref returns, how the JIT treats static readonly values, and why readonly does not make an object immutable.
readonly across fields, structs, members and refs, const versus static readonly, and immutability limits.
Mid-Level
Theory
Memory-Oriented C#
Β· π 3 follow-ups Β· π 1 real-world
-
What is a ref struct and when would you write one? Explain the rules (stack-only, no boxing, no class fields, no lambda capture), ref fields (C# 11), C# 13 changes (implementing interfaces, the allows ref struct anti-constraint, use in async and iterator methods), the Dispose pattern for ref structs, and walk through a ValueStringBuilder-style type.
Writing ref structs: rules, ref fields, C# 13 interface and generic support, and a stack-first builder example.
Senior
Coding
Memory-Oriented C#
Β· π 3 follow-ups Β· π 1 real-world
-
How do you use stackalloc safely in modern C#? Explain stackalloc into Span<T>, the unmanaged type requirement, stack size limits and why a stack overflow kills the process, the hybrid stackalloc-or-ArrayPool pattern, why you must not stackalloc in loops, SkipLocalsInit, and how to choose a threshold.
Safe stackalloc: span usage, size limits, hybrid pooling pattern, loops and SkipLocalsInit.
Mid-Level
Coding
Memory-Oriented C#
Β· π 3 follow-ups Β· π 1 real-world
-
When is unsafe code justified in modern C#, and what tools exist beyond raw pointers? Explain unsafe blocks, pointers and fixed (pinning), function pointers, NativeMemory, the System.Runtime.CompilerServices.Unsafe class, MemoryMarshal, what can go wrong (GC holes, buffer overruns, pinning cost), and how to keep unsafe code safe.
Unsafe C#: pointers, fixed, NativeMemory, the Unsafe class and MemoryMarshal, risks and guidelines.
Senior
Theory
Memory-Oriented C#
Β· π 3 follow-ups Β· π 1 real-world