Let's say I have a method that calls another asynchronous method immediately or similarly:
//Main method public async Task<int> Foo1( int x ) { var result = await DoingSomethingAsync(x ); return DoSomethingElse(result ); } //other method public async Task<int> Foo2( Double double ) { return await Foo1( Convert.ToInt32(double ) ); }
Is there any specific reason Foo2 needs / should have async / wait, and not just a call:
//other method public Task<int> Foo3( Double double ) { return Foo1( Convert.ToInt32( double ) ); }
The consumer would still be expected, in addition, regardless of:
int x = await Foo1(1); int x = await Foo2(1D); int x = await Foo3(1D);
All of these statements will be compiled. Will the compiler generate different ILs for two different methods?
source share