Is there a C# class that provides map with weak keys or/and weak values?
Or at least WeakHashMap like functionality.
Is there a C# class that provides map with weak keys or/and weak values?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In .Net 3.5 and below, there is no such structure available. However I wrote up one for a side project and posted the code at the following location.
Starting .NET 4.0, there is a structure available called
ConditionalWeakTablein the Runtime.CompilerServices namespace that also does the trick.