I'm trying to implement a cache for JObjects
.
I was surprised to see that they didn't override the GetHashCode
method and therefore, I can't use it as a unique key.
Since my json's are pretty large, I don't want to use JObject.ToString().GetHashCode
as a solution.
I did see that they have an internal method called GetDeepHashCode
but the implementation is based on other protected properties and therefore, I cannot "copy" the code and create an extension method from it.
I also don't want to use reflection and invoke the internal GetDeepHashCode
method.
I'm looking for a way to create a unique cache key for a JObject
and I don't want the method to be extra expensive when it comes to performance.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…