Код: Выделить всё
class Foo {
private ThreadLocal myInts = new ThreadLocal(() => new List());
public void Build() {
Parallel.For(0,100, x => {
myInts.Value.Add(x);
});
Parallel.For(0,100, x => {
myInts.Value.Add(x);
});
}
}
Подробнее здесь: https://stackoverflow.com/questions/792 ... -variables
Мобильная версия