У меня есть метод в классе, который мне нужно выполнить дважды асинхронно. Класс имеет конструктор, который принимает URL в качестве параметра:выполнить метод C# асинхронно с помощью Threading
ABC abc= new ABC(Url);
// Create the thread object, passing in the abc.Read() method
// via a ThreadStart delegate. This does not start the thread.
Thread oThread = new Thread(new ThreadStart(abc.Read());
ABC abc1= new ABC(Url2)
// Create the thread object, passing in the abc.Read() method
// via a ThreadStart delegate. This does not start the thread.
Thread oThread1 = new Thread(new ThreadStart(abc1.Read());
// Start the thread
oThread.Start();
// Start the thread
oThread1.Start();
Является ли это так, как это работает? Может ли кто-нибудь помочь?
вы также можете попробовать BackgroundWorker, если вам это подходит –