0
Posted on 7:33 AM by Softminer and filed under
C#,
Visual Studio
class Program { static BackgroundWorker _bw = new BackgroundWorker(); static void Main() { _bw.DoWork += TODO; _bw.RunWorkerAsync("Message to worker"); Console.ReadLine(); } void TODO(object sender, DoWorkEventArgs e) { // This is called on the worker thread // writes "Message to worker" Console.WriteLine (e.Argument); _backgroundworker.CancelAsync(); // Perform time-consuming task... } }
Post a Comment