D
Droopy
Hi,
1) Is it worth to replace all HashTable and ArrayList (framework 1.1) usage
by Dictionary and List (framework 2.0) ?
I suppose the answer would be yes as the 2.0 collections are type safe and
should perform better.
But are there as reliable ?
2) In a multithreading environment, what is the best way to prevent
concurrent accesses ?
For now, I implemented a static function that returns a clone copy of the
data collection (protected by a lock based on the SyncRoot property of the
data collection). This copy is used by all running threads that needs read
or write access to collection elements. Is it necessary as the collection
object is not modified, only its elements are (add to and remove elements
from collection is also protected by a lock on SyncRoot property).
Thanks in advance,
Droopy.
1) Is it worth to replace all HashTable and ArrayList (framework 1.1) usage
by Dictionary and List (framework 2.0) ?
I suppose the answer would be yes as the 2.0 collections are type safe and
should perform better.
But are there as reliable ?
2) In a multithreading environment, what is the best way to prevent
concurrent accesses ?
For now, I implemented a static function that returns a clone copy of the
data collection (protected by a lock based on the SyncRoot property of the
data collection). This copy is used by all running threads that needs read
or write access to collection elements. Is it necessary as the collection
object is not modified, only its elements are (add to and remove elements
from collection is also protected by a lock on SyncRoot property).
Thanks in advance,
Droopy.