2

I want to find the size of a MemoryCache.

MemoryCache _cache = MemoryCache.Default;
_cache.Add("key", "value");
FindSize(_cache);

I want to implement the FindSize() method.

Tim M.
  • 52,666
  • 12
  • 118
  • 157
vijayst
  • 17,769
  • 16
  • 62
  • 107

2 Answers2

0

I am afraid you can't find size of .NET object at runtime. See these answers for more details:

Community
  • 1
  • 1
Miroslav Bajtoš
  • 10,367
  • 1
  • 38
  • 95
0

Do you need the _cache.Count() value or something different?

Alex Filipovici
  • 30,755
  • 6
  • 52
  • 77