0

I'm trying to use the code seen here. When I try to execute this line

FieldInfo cachesInfo = cache.GetType().GetField("_caches", BindingFlags.NonPublic | BindingFlags.Instance);

cachesInfo ends up being null. I added a foreach loop to look at the object and my results show no field called "_caches".

_entries
_expires
_usage
_lock
_disposed
_totalCount
_publicCount
_maxCount
_maxCountOverload
_flushUndercount
_insertBlock
_useInsertBlock
_insertBlockCalls
_utcLastTrimCompleted
_iSubCache
_cacheMultiple
_cacheCommon

I'm using the code as is in the link. What is it that I'm missing?

(Warning: I am woefully ignorant on this subject but have been tasked with figuring it out. I know cachesInfo is null, I know I'm not seeing "_caches", but I don't know why).

Thanks greatly for your help.

Community
  • 1
  • 1
Metallicraft
  • 2,211
  • 5
  • 31
  • 52

1 Answers1

0

It looks like this is a difference in .Net versions. See here. The field "_caches" exists in .Net 3.5. I changed my code to look more like the .Net 2.0 example (using "_entries") and it works.

Metallicraft
  • 2,211
  • 5
  • 31
  • 52