25 C# Mistakes Freshers Make in Interviews
Codevity Admin · 10/25/2026
Codevity Admin · 10/25/2026
Interviewers see the same mistakes again and again. Each one below comes with the fix. They are grouped by topic, and each group points to the article that explains the idea in depth.
1. Confusing C# with .NET. C# is the language. .NET is the platform (runtime, libraries, tools) that runs it. See C# vs .NET vs the CLR.
2. Believing value types always live on the stack. A value-type variable stores its data where the variable lives. An int field of a class lives inside the object, on the heap. See value and reference types.
3. Assuming boxing is harmless. Boxing allocates. Putting value types into non-generic collections or object parameters in a hot path puts pressure on the garbage collector. Use generics.
4. Misunderstanding string immutability. s.ToUpper() does not change s, and += in a loop creates a new string every time. Use StringBuilder for loops. See strings in C#.
5. Confusing == with .Equals(). == is chosen by the compile-time type, Equals() by the run-time type. For classes, the default for both is reference equality unless overridden.
6. Using double or float for money. Binary floating point cannot represent values like 0.1 exactly. Use decimal for currency.
7. Confusing overloading with overriding. Overloading is same name, different parameters, chosen at compile time. Overriding replaces a virtual method and is chosen at run time.
8. Hiding a method with new by accident. Without virtual and override, a call through a base-class reference still runs the base method. See OOP in C#.
9. Using public fields instead of properties. public int Age; cannot validate, log or change without breaking callers. Use a property.
10. Over-using inheritance. Deep hierarchies are brittle. Prefer composition: give a class the collaborators it needs.
11. Over-using static. Entire applications built from static classes cannot be unit tested or injected. See DI, SOLID and unit testing.
12. Modifying a collection while enumerating it. Removing from a List<T> inside foreach throws InvalidOperationException. Use RemoveAll or iterate a copy.
13. Using a custom class as a dictionary key without Equals and GetHashCode. Lookups fail because equality falls back to references. See collections.
14. Enumerating a LINQ query several times. Calling , and then on the same deferred query runs it three times. Call once if you need the results repeatedly. See LINQ in C#.
15. Calling on a possibly empty sequence. It throws. Use and handle the or default value.
16. Re-throwing with . It resets the stack trace and hides where the error began. Use . See exceptions and IDisposable.
17. Swallowing exceptions with an empty . Real failures disappear. Log them, handle them, or let them propagate.
18. Not disposing unmanaged resources. The garbage collector does not close file handles, connections or sockets promptly. Use . See garbage collection.
19. Ignoring nullable warnings. Each warning is a possible . Fix them instead of silencing them.
20. Using for business logic. Callers cannot await it or catch its exceptions, and an unhandled exception can crash the process. Return . See async and await.
21. Blocking on async code with or . It wastes threads and can deadlock. Use all the way up.
22. Building SQL with string concatenation. It enables SQL injection. Always use parameterized queries.
23. Writing non-deterministic unit tests. Tests that depend on the system clock, hard-coded file paths or live network calls fail randomly. Inject a clock and use fakes.
24. Jumping into code without clarifying. Ask about input, empty collections, duplicates and expected complexity first.
25. Guessing under pressure. An invented answer costs more than "I am not sure, but I would reason from..." and then reasoning aloud.
Pick the five mistakes you recognise yourself in, write a short program that shows each one going wrong, and then fix it. After that, work through the top 50 questions.
.Count().Any()foreach.ToList().First().FirstOrDefault()nullthrow ex;throw;catch { }usingNullReferenceExceptionasync voidTask.Result.Wait()awaitnull