A little knowledge is a dangerous thing ;-) Yes, you could use the Meta Knight offer and use SyncRoot , but you need to be careful - this is not a panacea. See this post from the Team BCL blog from Microsoft to see why itβs not as easy as SyncRoot . Quotes from this post:
Several insightful users of our generic collections have noted that we no longer provide the public SyncRoot property on SyncRoot ICollection<T>
and
I think itβs better for us to make people think more about synchronization, and frankly, the SyncRoot property on our shared collection does not provide any value.
Of course, in order not to say that it cannot be used under any circumstances - you just need to carefully study the use cases and not be on autopilot.
Vinay sajip
source share