ValueTask for synchronous method
I am implementing a simple lookup service using concurrent dictionary to store data.
Since most of the methods using this service will be async I am considering exposing the lookup functions with ValueTask.
Pseudocode:
public ValueTask GetResultAsync(string key)
{
return ValueTask.FromResult(_dictionary.FirstOrDefault(p => p.Key == key).Value);
}
Does this approach make sense and is there any caveats ?