What is a destructor in C# and when is it used?

Heisenbug logo
TheHeisenBug

Search

Search across questions, learning content, and hands-on projects

Ace Your Next Tech Interview

5,986+ interview questions across 87 technologies — with expert answers, advanced search, AI-powered assistance, personal highlights, structured learning paths, and hands-on practice projects.

5,986+Questions & Answers
87Technologies
AdvancedSearch
Built-inAsk AI
PersonalHighlights
StructuredLearning Paths
Hands-onPractice Projects

Lifetime Access

One-time payment. No subscriptions. Unlock everything, forever.

$19.90USD

or R$49.90 BRL

FeatureFreePremium
Question titlesAllAll
Answers per topicTop 5All
Learning chaptersFirst 5All
Practice projectsFirst 3All
Highlights
Ask AI
Read tracking
Search

C# Interview Questions

  1. [JUNIOR] What is C# and what are its main features?
  2. [MID] What is the difference between abstract classes and interfaces in C#?
  3. [MID] What are delegates in C# and how are they used?
  4. [JUNIOR] What are the four pillars of object-oriented programming in C#?
  5. [JUNIOR] What is the difference between a class and a struct in C#?
  6. [JUNIOR] What are the different data types in C#?
  7. [MID] What is LINQ in C# and what is the difference between query syntax and method syntax?
  8. [MID] How does exception handling work in C# with try-catch-finally blocks?
  9. [MID] What is the difference between String and StringBuilder in C#?
  10. [MID] What is async and await in C# and how does asynchronous programming work?
  11. [SENIOR] How does garbage collection work in .NET and how can you optimize it?
  12. [SENIOR] What are the SOLID principles and how do you apply them in C#?
  13. [JUNIOR] What is the Common Language Runtime (CLR) and what does it do?
  14. [JUNIOR] What is the difference between value types and reference types in C#?
  15. [JUNIOR] What are namespaces in C# and why are they used?
  16. [JUNIOR] What are access modifiers in C# and what are the different types?
  17. [MID] What is Boxing and Unboxing in C# and how does it affect performance?
  18. [MID] What are generics in C# and what are their benefits?
  19. [MID] What is the difference between method overloading and method overriding in C#?
  20. [MID] What are extension methods in C# and how do you create one?
  21. [MID] What are events in C# and how do they relate to delegates?
  22. [SENIOR] How would you implement dependency injection in a C# application?
  23. [SENIOR] What is the difference between Task and Thread in C# and when would you use each?
  24. [SENIOR] What is the Repository pattern and how is it used with Entity Framework?
  25. [SENIOR] How would you design a thread-safe singleton in C#?
  26. [JUNIOR] What is inheritance in C# and does C# support multiple inheritance?
  27. [JUNIOR] What is polymorphism in C# and how is it achieved?
  28. [JUNIOR] What is encapsulation in C# and how do you implement it?
  29. [JUNIOR] What are properties in C# and how do they differ from fields?
  30. [JUNIOR] What is an enum in C# and when would you use one?
  31. [JUNIOR] What is the difference between a constant and a readonly variable in C#?
  32. [MID] What is the difference between ref and out keywords in C#?
  33. [MID] What is the difference between IEnumerable and IQueryable in C#?
  34. [MID] What is the difference between a sealed class and a static class in C#?
  35. [MID] What is the using statement in C# and how does it relate to the IDisposable interface?
  36. [MID] What are partial classes in C# and when would you use them?
  37. [SENIOR] What is reflection in C# and what are its performance trade-offs?
  38. [SENIOR] How do you handle deadlocks in multi-threaded C# applications?
  39. [SENIOR] What is the difference between covariance and contravariance in C# for delegates and interfaces?
  40. [SENIOR] What is the yield keyword in C# and how does it work with iterators?
  41. [SENIOR] What are the different types of garbage collection in .NET and how can you configure them?
  42. [EXPERT] How does the JIT compiler work in C# and what optimizations does it perform?
  43. [EXPERT] What are expression trees in C# and how can they be used to build dynamic queries?
  44. [JUNIOR] What are constructors in C# and what are the different types?
  45. [JUNIOR] What is a destructor in C# and when is it used?
  46. [JUNIOR] What is the difference between the == operator and the Equals() method in C#?
  47. [JUNIOR] What is a nullable type in C# and how do you declare one?
  48. [MID] What is the difference between early binding and late binding in C#?
  49. [MID] What is a virtual method in C# and how does it differ from method hiding with the new keyword?
  50. [MID] What is constructor chaining in C# and how do you implement it?
  51. [MID] What is the difference between IEnumerable, ICollection, and IList in C#?
  52. [SENIOR] What is the Factory Method pattern and how do you implement it in C#?
  53. [SENIOR] How would you implement event-driven architecture in C#?
  54. [SENIOR] What is the difference between ValueTask and Task and when should you use each?
  55. [SENIOR] What is the difference between Task.WhenAll and Task.WhenAny in C#?
  56. [SENIOR] What is the Observer pattern and how do C# events and delegates implement it?
  57. [EXPERT] What are Span<T> and Memory<T> in C# and when would you use one over the other?
  58. [EXPERT] How do you implement a custom awaitable type in C#?
  59. [EXPERT] What is the Roslyn Compiler Platform and how can it be used for code analysis and generation?
  60. [JUNIOR] What are jagged arrays in C# and how do they differ from multidimensional arrays?
  61. [JUNIOR] What is a tuple in C# and when would you use one?
  62. [JUNIOR] What is the difference between the "is" and "as" operators in C#?
  63. [MID] What are indexers in C# and how do you implement them?
  64. [MID] What is a multicasting delegate in C# and how does it work?
  65. [MID] What is the difference between Dispose() and Finalize() methods in C#?
  66. [MID] What is the difference between a deep copy and a shallow copy in C#?
  67. [SENIOR] What is the difference between the Strategy pattern and the Template Method pattern in C#?
  68. [SENIOR] What is lazy initialization in C# and how does Lazy<T> work?
  69. [SENIOR] How do you implement a custom IComparer<T> for sorting in C#?
  70. [SENIOR] What is middleware in ASP.NET Core and how does the request pipeline work?
  71. [SENIOR] What is Entity Framework and what is the difference between Code-First and Database-First approaches?
  72. [EXPERT] What are weak references in C# and when would you use them?
  73. [EXPERT] How does the .NET runtime handle assembly loading and resolution?
  74. [EXPERT] What is stackalloc in C# and when should it be used for performance-critical code?
  75. [EXPERT] What is object pooling in C# and how does it improve performance in high-throughput applications?
  76. [JUNIOR] What is string interpolation in C# and how does it work?
  77. [JUNIOR] What is the difference between Array and ArrayList in C#?
  78. [MID] What is the difference between the dynamic type and the object type in C#?
  79. [MID] What are null-conditional operators and the null-coalescing operator in C#?
  80. [SENIOR] What are cancellation tokens in C# and how do you use them with async operations?
  81. [SENIOR] What is the difference between composition and inheritance and which is preferred in C#?
  82. [EXPERT] How do you perform compile-time code generation with source generators in C#?
  83. [EXPERT] What is the volatile keyword in C# and how does it affect memory ordering?
  84. [EXPERT] How do you implement a custom attribute in C# and retrieve it via reflection?
  85. [EXPERT] How do you prevent memory leaks in long-running .NET services?
  86. [JUNIOR] What is the difference between the break and continue statements in C#?
  87. [MID] What is the difference between Array.CopyTo() and Array.Clone() in C#?
  88. [SENIOR] What is serialization in C# and what are the different serialization formats available?
  89. [EXPERT] What are asynchronous streams in C# and how do IAsyncEnumerable<T> and await foreach work?
  90. [EXPERT] How do you ensure compatibility when building libraries targeting multiple .NET versions with multi-targeting?
  91. [EXPERT] What is the difference between Abstract Factory and Factory Method patterns and when would you use each in C#?