Here are the examples of the csharp api System.Threading.Tasks.Task.FromResult(TV) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
3 Examples
19
Source : DataLoaderBase.cs
with MIT License
from ChilliCream
with MIT License
from ChilliCream
protected void TryAddToCache<replacedem, TK, TV>(
string cacheKeyType,
IEnumerable<replacedem> items,
Func<replacedem, TK> key,
Func<replacedem, TV> value)
where TK : notnull
{
if (_cache is not null)
{
foreach (replacedem item in items)
{
TaskCacheKey cacheKey = new(cacheKeyType, key(item));
_cache.TryAdd(cacheKey, () => Task.FromResult(value(item)));
}
}
}
19
Source : DataLoaderBase.cs
with MIT License
from ChilliCream
with MIT License
from ChilliCream
protected void TryAddToCache<TK, TV>(
string cacheKeyType,
TK key,
TV value)
where TK : notnull
{
if (_cache is not null)
{
TaskCacheKey cacheKey = new(cacheKeyType, key);
_cache.TryAdd(cacheKey, () => Task.FromResult(value));
}
}
19
Source : PropertiesBase.cs
with MIT License
from phylomeno
with MIT License
from phylomeno
public Task<TV> GetAllAsync()
{
return Task.FromResult(Properties);
}