C# Interview Questions
Practice C# questions covering .NET framework, LINQ, async/await, generics, delegates, and enterprise application patterns.
Frequently Asked Questions
What C# topics should I study for interviews?
Core topics include OOP principles in C#, LINQ, async/await patterns, generics, delegates and events, exception handling, interfaces vs abstract classes, and dependency injection. Framework-specific topics include Entity Framework, ASP.NET Core, and the .NET runtime (GC, JIT).
Is C# still relevant for modern development?
Absolutely. C# powers enterprise applications, game development (Unity), cloud services (Azure), and cross-platform apps (.NET MAUI). Microsoft's continued investment in .NET and C# keeps it among the top programming languages. It's especially dominant in enterprise and game development.
How does async/await work in C#?
async marks a method as asynchronous. await pauses execution until the Task completes without blocking the thread. The compiler transforms async methods into state machines. Use async/await for I/O-bound operations (HTTP calls, database queries, file operations) to keep applications responsive.
What is LINQ and how is it used?
Language Integrated Query provides SQL-like syntax for querying collections, databases, and XML in C#. It supports method syntax (collection.Where().Select()) and query syntax (from x in collection where...). LINQ improves readability and reduces boilerplate for data manipulation.
What are delegates and events in C#?
Delegates are type-safe function pointers that reference methods. Events are a pattern built on delegates for publish-subscribe communication. Action<T> and Func<T> are built-in delegate types. Events are used extensively in UI frameworks, game development, and event-driven architectures.
How does garbage collection work in .NET?
The .NET GC uses generational collection (Gen 0, 1, 2) based on object lifetime. Short-lived objects are collected quickly in Gen 0. Long-lived objects promote to higher generations. The Large Object Heap handles objects over 85KB. Understanding GC helps with performance optimization and avoiding memory pressure.