What is the difference between the Add1() and Add2() methods? Is there any difference at all? For all I know, the usage (as shown in the UsageTest() method) is the same.
private async Task<int> Add1(int a, int b) { return await Task.Run( () => { Thread.Sleep(1000); return a + b; }); } private Task<int> Add2(int a, int b) { return Task.Run( () => { Thread.Sleep(1000); return a + b; }); } private async void UsageTest() { int a = await Add1(1, 2); int b = await Add2(1, 3); }
source share