This article is a mirror article of machine translation, please click here to jump to the original article.

View: 22348|Reply: 0

[Source] .net/c# multithreaded modifying collections will be a problem?

[Copy link]
Posted on 7/4/2017 3:12:19 PM | | |
I have 100 elements in the collection, and under the condition of ensuring that the number of collections does not change, I multi-thread the elements in the collection are not thread-safe and will not throw exceptions

The multithreaded modification collection I am talking about is not added, not deleted, only modified, as follows:

List<> Collection has 100 elements in it, and the collection does not add elements or delete elements



It's just multithreading to modify one or more elements in a collection




Above is the test code, and the result is not throwing an exception!






Previous:123123{:1_2:}
Next:Introduction and introduction to SignalR
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com