Is a List <T> constructor a thread safe?

In particular, is List (T) (IEnumerable (T)) thread safe if the IEnumerable used to initialize the list changes while building a new list?

+3
source share
2 answers

This has nothing to do with the fact that the List constructor is thread safe; it depends only on whether IEnumerable is thread safe.

The constructor is not thread safe, but in this case it is not a problem. The constructor does nothing that compromises thread safety; it is an IEnumerable security problem, which can be a problem.

+6
source

, IEnumerable<T>, . ? , (, : ). .NET ; 4.0 , .

createD ( ), - - .

+1

Source: https://habr.com/ru/post/1734804/


All Articles