Why a C# Interview Is Not an Exam, But a Dialogue
\n\nImagine: you're sitting across from a team lead or senior developer. They look at you not as an enemy, but as a future colleague. But your mind is foggy, your hands are sweating, and when asked about IDisposable, you suddenly forget what it even is. Sound familiar?
A C# interview is not a school test where you just need to "guess the letter." It's a check of your engineering mindset, your ability to reason, and, of course, your basic knowledge of the .NET platform. In this article, we'll break down the main topics that are actually asked in interviews (spoiler: 80% of questions repeat from one time to the next).
\n\nThe Basics You Need to Know by Heart
\n\nIf you're heading to an interview in an hour and have no time to prepare, read this section. This is the "bread and butter" of a C# developer. Without this knowledge, you won't even be hired as a junior.
\n\n1. Data Types: Value vs Reference
\n\nThis is perhaps the most popular question. The interviewer doesn't just want to hear "int is a value type, class is a reference type." They need to know if you understand how this works under the hood.
\n\n// Example often given in interviews\nstruct Point {\n public int X;\n public int Y;\n}\n\nclass PointClass {\n public int X;\n public int Y;\n}\n\nvoid Main() {\n Point p1 = new Point { X = 10, Y = 20 };\n Point p2 = p1;\n p2.X = 999;\n Console.WriteLine(p1.X); // 10 — copy\n\n PointClass pc1 = new PointClass { X = 10, Y = 20 };\n PointClass pc2 = pc1;\n pc2.X = 999;\n Console.WriteLine(pc1.X); // 999 — reference\n}\n\nThe key point: struct is copied entirely, class is passed by reference. And yes, string is a reference type, but behaves like a value type due to immutability. This is also often asked about.
2. Boxing and Unboxing
\n\nA simple topic, but interviewers love it. Imagine you put a value type (int) into an object. Boxing occurs. When you take it back out, unboxing occurs. This is expensive in terms of performance.
\n\nint number = 42;\nobject boxed = number; // boxing\nint unboxed = (int)boxed; // unboxing\n\nIn modern projects, this is rare, but knowing the mechanism shows you understand how .NET manages memory.
\n\n3. Interfaces and Abstract Classes
\n\nA classic question: "When to use an interface and when to use an abstract class?"
\n\n- \n
- Interface — a contract. If you have different classes that should be able to do the same thing (e.g., fly: airplane, bird, drone). \n
- Abstract class — a base implementation. If classes share common logic (e.g., all animals breathe, but differently). \n
public interface IFlyable {\n void Fly();\n}\n\npublic abstract class Animal {\n public abstract void MakeSound();\n public void Breathe() => Console.WriteLine("Inhale-Exhale");\n}\n\nIn C# 8.0+, interfaces have default implementations, but in an interview it's better to talk about the classic approach.
\n\nAdvanced Questions: Where the Catch Is
\n\nOnce the basics are covered, the interviewer starts "digging deeper." Here are the topics that most often cause a mental block.
\n\n4. Async/Await and Threads
\n\nMany people confuse asynchrony with multithreading. Remember: async/await is about freeing up a thread, not creating a new one.
public async Task<string> GetDataAsync() {\n using HttpClient client = new HttpClient();\n // The thread is freed while waiting for the response\n string result = await client.GetStringAsync("https://example.com");\n return result;\n}\n\nOften asked about ConfigureAwait(false). The answer: it's needed to avoid returning to the original synchronization context (e.g., in a WPF UI thread). In libraries — always use it; in applications — use with caution.