You can use a global WeakKeyDictionary keyed by the object to achieve the same without having anything on the object.


On Friday, October 16, 2020, 09:37:05 AM GMT+1, Ram Rachum <ram@rachum.com> wrote:

Did you mean like keeping a hidden attribute on the object with the result? Well, that'd require manually keeping track of these attributes for each method I'm caching. I do that sometimes, but it's verbose.