How is ConcurrentDictionary accessed and how to serialize it?

I had not used the ConcurrentDictionary object before and had a couple of questions about this:

  • I correct that several threads can read from the dictionary at the same time, but if it is written, no other thread can access it?

  • Can this object be serialized to disk?

Thank.

+5
source share
2 answers

I correct that several threads can read from the dictionary at the same time, but if it is written, no other thread can access it?

No, you can safely read and write from multiple threads. Of course, internally, I assume that some synchronization is occurring, but the performance penalty should be small, and you should not worry about it and perform any additional synchronization.

Can this object be serialized to disk?

, .

+13
  • , , , ?

, .

  1. ?

, [Serializable]. <K,V> Serializer, .

+3

All Articles