I know how to convert a ConcurrentDictionary to a Dictionary.
And I know that I can use reflection to determine if an object contains a ConcurrentDictionary.
But after I determined that an object does have a ConcurrentDictionary via reflection, how do I convert it to a Dictionary at runtime? Or can I do it at all? It's going to change the definition of the class, right?
Edit: I should have made it more clear. I'll show an example:
[Serializable]
[DataContract]
public class CacheItem
{
[DataMember]
private ConcurrentDictionary<string, CacheItemEntity> _cacheItemDictionary = new ConcurrentDictionary<string, CacheItemEntity>();
......
}
When I serialize an instance of this class, AVRO can't serialize the ConcurrentDictionary. So I wondered if I can convert the ConcurrentDictionary to a normal Dictionary at runtime. And this certainly changes the definition of the class. I'm just wondering if it can be done this way.