Type System & Memory Model
What is the difference between const and readonly? When is the value of each evaluated?
What is the difference between a value type and a reference type in C#?
What is the difference between the stack and the heap, and what gets stored on each?
Explain the difference between a struct and a class. When would you choose one over the other?
What is boxing and unboxing, and why is it generally considered a performance bottleneck?
Can a struct implement an interface? Can it inherit from a class?
CLR & Runtime Fundamentals
What is the difference between managed and unmanaged code?
What is the Common Language Runtime (CLR), and what are its primary responsibilities?
What is the difference between C#, .NET, and the CLR (Common Language Runtime)?
What is an 'Assembly' in .NET, and what is the difference between a Private and a Shared Assembly?
Explain the role of the Just-In-Time (JIT) compiler in the .NET execution process.
What are Attributes in C#, and how can they be retrieved at runtime?
Explain the difference between JIT (Just-In-Time) compilation and AOT (Ahead-Of-Time) compilation. What are the tradeoffs of Native AOT?
What is the role of the Global Assembly Cache (GAC) in modern .NET (Core) vs. .NET Framework?
What are the different access modifiers in C#, and what does protected internal specifically mean?
Explain the difference between method overriding and method overloading.
What are the different types of classes in C# (abstract, static, partial, sealed)?
Explain the difference between an interface and an abstract class. When is one preferred over the other?
What is the purpose of the sealed keyword? Why might you seal a class for performance reasons?
What are extension methods, and how do they achieve polymorphism without inheritance?
What is a static constructor, and when is it executed?
Explain the 'Diamond Problem' and how C# handles multiple inheritance through interfaces.
How do Default Interface Methods work, and why were they added to the language?
Core Language Operators & Conversions
What is the difference between the is and as operators?
Explain the difference between ref, out, and in parameters. Why would you use in for performance?
Explain the difference between var, dynamic, and object.
What is the difference between == and the Equals() method in C#?
What is operator overloading, and what are the rules and limitations around it?
How do implicit and explicit conversion operators work in C#?
What is the difference between String and StringBuilder in terms of memory allocation?
How are enums represented in C#, and what is the [Flags] attribute used for?
Why are strings immutable in C#, and what is string interning?
What is the difference between a Tuple and a ValueTuple?
What is the difference between First, FirstOrDefault, Single, and SingleOrDefault in LINQ?
Explain the concept of Deferred Execution in LINQ. Why is it important for performance?
What is the difference between IEnumerable<T> and IQueryable<T>? When would you choose one over the other?
When would you use a yield return statement?
What is the difference between Array.Sort() and LINQ's .OrderBy()?
What is the difference between IEnumerable<T>, ICollection<T>, and IQueryable<T>?
What is the difference between Select and SelectMany?
Explain the yield keyword and how it creates an iterator state machine.
What is the difference between yield return and returning a concrete List<T>?
Explain the null-coalescing (??) and null-conditional (?.) operators and when you'd use them.
What are the benefits of generics, and how do they differ from using object?
What is the difference between Func, Action, and Predicate delegates?
What is a delegate, and how does it differ from an event?
What are the different dependency injection lifetimes in .NET?
Explain the concept of Inversion of Control (IoC) and how it is supported natively in the .NET Base Class Library.
What are Nullable Reference Types, and what problem do they solve?
What is Nullable<T> (a nullable value type), and how does it work under the hood?
What are generic constraints (the where clause), and why would you use them?
What is Variance (Covariance and Contravariance) in C# Generics? Why can't you pass a List<string> into a method expecting a List<object>?
What are Interceptors in C# 12, and what is their primary use case in source generators?
What are Source Generators, and how do they differ from Reflection in terms of performance and timing?
What is a closure in C#, and how does variable capture in a lambda work?
Collections & Data Structures
What is the difference between IEnumerable, ICollection, and IList?
How does a List<T> work internally when it reaches its capacity? What is the Big-O complexity of adding an item?
What are thread-safe collections like ConcurrentDictionary, and when would you use them?
How does a Dictionary<K, V> work internally? What happens during a hash collision?
What are Frozen Collections (introduced in .NET 8), and when would you use them over a standard Dictionary or HashSet?
What is a WeakReference, and when would you use one?
Equality Comparison & Ordering
Explain how try/catch/finally works and what exception filters (when clauses) add.
Explain the difference between throw and throw ex. Why does it matter for debugging?
What is the relationship between Equals() and GetHashCode(), and why must you override both together?
What are best practices for creating and throwing custom exceptions in C#?
What is the difference between IComparable and IComparer, and when would you use each?
Explain the difference between a Thread, a Task, and a Thread Pool thread.
What is the difference between Task.Wait() and await Task?
What is the risk of using .Result or .Wait() on an asynchronous task?
How does a CancellationToken work to stop an asynchronous operation?
Explain how the async and await keywords work under the hood. What is the state machine?
What is the difference between a Task and a ValueTask, and when should you prefer one over the other?
Explain the purpose of ConfigureAwait(false). When is it necessary, and when should it be avoided?
What is the difference between Task.Run() and Task.Factory.StartNew()?
What is a deadlock in an asynchronous context, and how can you prevent it?
What is the new System.Threading.Lock type in .NET 9, and how does it differ from lock(obj)?
Why is async void generally considered a bad practice, and what are the rare exceptions where it is acceptable?
Explain IAsyncEnumerable<T> and how it differs from a standard Task<IEnumerable<T>>.
How does the lock statement work internally? What is the difference between lock and Monitor?
What does the volatile keyword do, and when is it needed?
What is the difference between lock, Mutex, and SemaphoreSlim for synchronization?
Explain the 'using' statement. What happens to the object when the block execution finishes?
What is the difference between a Finalizer and the IDisposable interface? When would you use one over the other?
What is a memory leak in a managed environment like C#, and how can it happen?
Explain the IDisposable interface and the using statement. Why is it necessary even with a Garbage Collector?
How does the .NET Garbage Collector work? Explain the concept of Generations (0, 1, and 2).
What is the Large Object Heap (LOH), and why is it handled differently by the GC?
What is Reflection, and what are the performance implications of using it extensively?
What are Span<T> and Memory<T>, and what specific problem do they solve regarding memory allocation?
What is 'pinning' an object in memory, and when would you need to do it?
When would you use GC.Collect(), and what are the trade-offs of calling it manually?
Explain the difference between the Small Object Heap (SOH) and the Large Object Heap (LOH). Why is LOH fragmentation a concern?
Explain the concept of ref struct like Span<T>. Why can it only exist on the stack, and what are its limitations?
Modern Csharp Language Features
What are primary constructors in C# 12, and how do they differ from traditional constructors?
What are C# Records, and how do they differ from standard classes?
What are Collection Expressions in C# 12, and how do they provide a unified syntax for different collection types?
Explain pattern matching in C# and when you would use it over a standard if/else or switch block.
What are required members (introduced in C# 11), and what problem do they solve for object initialization?
What is Pattern Matching in C#, and how has it evolved in recent versions?
What is the Spread Operator in C# collection expressions, and how does it differ from traditional concatenation?
Explain the 'params collections' feature in C# 13. How does it improve over the old params array?
Explain the field keyword introduced in C# 13 and how it simplifies property backing fields.