public void TestThread() { Account account = NewAccount6(); var errors = new ConcurrentBag <Exception>(); try { Thread[] threads = new Thread[_numberOfThreads]; AccessTest accessTest = new AccessTest(); for (int i = 0; i < _numberOfThreads; i++) { Thread thread = new Thread(() => { Run(accessTest.GetAccount, errors); }); threads[i] = thread; } for (int i = 0; i < _numberOfThreads; i++) { threads[i].Start(); } } finally { } if (errors.Any()) { throw new AggregateException(errors); } }
public void TestThread() { Account account = NewAccount6(); try { Thread[] threads = new Thread[_numberOfThreads]; AccessTest accessTest = new AccessTest(); for (int i = 0; i < _numberOfThreads; i++) { Thread thread = new Thread(new ThreadStart(accessTest.GetAccount)); threads[i] = thread; } for (int i = 0; i < _numberOfThreads; i++) { threads[i].Start(); } } finally { } }