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?
If you know result already, it means that there is no IO call or required to wait but other part of your method required await.
For clarity I assume that you want to return value 1 for first condition.
If knownResult is int then (no await)