I have a main thread that populates a List
. Further I create a chain of objects that will execute on different threads, requiring access to the List. The
As long as you are certain that the List
will never be modified then it will be safe to read from multiple threads. This includes the use of the IEnumerator
instances it provides.
This is going to be true for most collections. In fact, all collections in the BCL should be stable during enumeration. In other words, the enumerator will not modify the data structure. I can think of some obscure cases, like a splay-tree, were enumerating it might modify the structure. Again, none of the BCL collections do that.