質問

Does XElement.Remove() function thread safe?such as in Parallel.Foreach.and I can ensure the nodes in different threads are different.

役に立ちましたか?

解決

None of LINQ to XML is thread-safe for modifications.

In general, you will almost never find a mutable thread-safe object, unless it has been specifically designed for thread-safety (System.Collections.Concurrent).

The one major exception to this rule (Java's original collection framework) is widely regarded as a mistake, and has been replaced with separate concurrent and non-thread-safe versions.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top