Take a look at this code:
public async Task<int> GetResult(string param1)
{
if(param1 == "abc")
return _knownResult;
else
return await LongDatabaseCall();
}
Given that LogDatabaseCall
will return a Task<int>
, which might be saved into _knownResult
, what should be the type of _knownResult
— Task<int>
or ValueTask<int>
, performance-wise?