📁 Sangam Dhakal - Portfolio v2.0 - Netscape Navigator 4.0
_
□
×

πŸ“š .NET Interview Questions

377 questions for senior .NET engineer interviews, each with a 30-second answer, the full answer, a deep dive, the follow-ups interviewers ask next, and real-world production problems.

Types

Value and reference types, nullable value and reference types, boxing and unboxing, type inference with var, default, object and dynamic.

  1. What is the difference between value types and reference types in C#? Explain copy semantics, equality, where they are stored, and why "value types live on the stack" is only partly true.

    Value types versus reference types in .NET 10: what each kind is, copy and assignment semantics, default equality, real storage locations, object overhead, and how to choose.

    Junior Theory Types Β· πŸ”— 3 follow-ups
  2. What are nullable value types (Nullable<T>, int?) in C#? How do HasValue, Value, GetValueOrDefault, lifted operators and boxing of a null nullable work?

    Nullable value types in C#: the Nullable<T> struct, safe access patterns, lifted arithmetic and comparison operators, three-valued bool logic, boxing behaviour and database mapping.

    Junior Theory Types Β· πŸ”— 2 follow-ups
  3. What are nullable reference types in C#? Explain the annotations (? and !), how the compiler's null-state flow analysis works, attributes such as [NotNullWhen] and [MemberNotNull], and their limits at run time.

    Nullable reference types (NRT) in C# 14: nullable contexts, annotations and the null-forgiving operator, flow analysis, nullable attributes, generics, and the gaps where nulls still get through at run time.

    Mid-Level Theory Types Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  4. What are boxing and unboxing in C#? Where does hidden boxing happen, what does it cost, and how do you find and remove it?

    Boxing and unboxing in .NET 10: what the runtime does, the exact-type rule for unboxing, the common hidden boxing sites, the cost in allocations and GC, and the tools and fixes to remove it.

    Mid-Level Debugging Types Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  5. How does type inference work in C#? When should you use var, target-typed new and inferred lambda types, and when does explicit typing read better?

    Type inference in C# 14: var and its rules, anonymous types, target-typed new and collection expressions, generic method inference, natural lambda types, and the readability and LINQ traps that guide when to be explicit.

    Junior Theory Types Β· πŸ”— 2 follow-ups
  6. What does default mean in C#? Explain default(T), the default literal, default values of structs, enums and reference types, and how default is used in generics and optional parameters.

    The default keyword and default values in C# 14: all-zero memory, default(T) and the default literal, struct and enum pitfalls, generic code that returns default, and the other meanings of the word default in C#.

    Junior Theory Types Β· πŸ”— 2 follow-ups
  7. Every C# type derives from System.Object. What members does it give you? Then review a Customer class that overrides Equals to compare Email but does not override GetHashCode: what breaks, and how do you implement equality correctly (or use a record)?

    System.Object's members and contracts, reviewed through a broken Equals override: the Equals/GetHashCode contract, IEquatable<T>, operators, inheritance pitfalls, records, ToString and MemberwiseClone.

    Mid-Level CodeReview Types Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  8. What is dynamic in C#? How does the DLR bind calls at run time, how does it differ from object and var, and when is it a reasonable choice?

    The dynamic type in C#: run-time binding through the DLR and call-site caches, comparison with object and var, the costs (errors at run time, performance, trimming and AOT), and the narrow cases where it is still justified.

    Mid-Level Theory Types Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world

🌐 Sangam's Webring

βͺ Previous 🏠 Main Next ⏩
πŸ’¬ Chat with me