BackgroundWorker RunWorkerAsync似乎不会触发

时间:2018-02-23 17:24:15

标签: c# .net backgroundworker

我有这段代码

class Program
{
    private static void test(int i)
    {            
        Console.WriteLine(i);
    }
    static void Main(string[] args)
    {
        BackgroundWorker worker = new BackgroundWorker();
        int i = 5;
        worker.DoWork += (obj, ev) => test(i);            
        worker.RunWorkerAsync();
    }
}

当我运行它时,没有打印任何内容。我做错了什么?

0 个答案:

没有答案