Skip to main content
InterviewHubPRO
Section Overview
Q24

Question 24 of 50

Part 2: Concurrency, Zero-Allocation & Advanced Language Features (11 - 24)

48%
C# & CLR Internals (50 Qs)•Part 2: Concurrency, Zero-Allocation & Advanced Language Features (11 - 24)

What is WeakReference<T> and ConditionalWeakTable in .NET?

senior LevelcsharpConcurrency

In Simple Words: A WeakReference<T> references an object without preventing the Garbage Collector from collecting it. ConditionalWeakTable<TKey, TValue> allows you to attach metadata to an object without altering the class or creating memory leaks (when the key is collected, the value is automatically freed).