簡體   English   中英

將.NET任務與方法和動作一起使用有什么區別?

[英]What the difference between using .NET tasks with method and action?

方法:

static void HelloWorld() { Console.WriteLine(“Hello, world!”); }

之間有什么區別

Task t1 = new Task(HelloWorld);

Task t2 = new Task(new Action(HelloWorld));

實際上沒有區別。 實際上,在兩種情況下,編譯器都會生成相同的代碼:

Task task2 = new Task(new Action((object) null, __methodptr(HelloWorld)));

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM