3 ms·
Does ConditionalWeakTable<TKey,TValue> class from the current .NET do what you want? It can attach arbitrary state to objects, you can do that in extension meth
by Const-me 7y ago
Does ConditionalWeakTable<TKey,TValue> class from the current .NET do what you want? It can attach arbitrary state to objects, you can do that in extension methods or any other places.
- headmelted 7y agoYeah that’s what I was referring to above - I implemented this before with CWT, but what happens to the underlying object when my reference runs out of scope? What happens to the attached state of that object if it’s collected? How is the reference held in the CIL bytecode? If composition isn’t implemented as a core language feature and officially supported then I’ve no way of knowing exactly how my implentation will behave or perform in the future or if there will be breaking changes down the road that render the foundation I’ve built all my code on moot.