提交 8a0356bc 编写于 作者: C Cyrus Najmabadi

Use simple 'using' statement

上级 1f81d8d7
...@@ -93,19 +93,15 @@ public virtual bool Remove(TKey id) ...@@ -93,19 +93,15 @@ public virtual bool Remove(TKey id)
private async Task<bool> WriteToStreamAsync(TValue value, TData data, CancellationToken cancellationToken) private async Task<bool> WriteToStreamAsync(TValue value, TData data, CancellationToken cancellationToken)
{ {
using (var stream = SerializableBytes.CreateWritableStream()) using var stream = SerializableBytes.CreateWritableStream();
{ WriteTo(stream, data, cancellationToken);
WriteTo(stream, data, cancellationToken);
var solution = GetSolution(value); var solution = GetSolution(value);
var persistService = solution.Workspace.Services.GetService<IPersistentStorageService>(); var persistService = solution.Workspace.Services.GetService<IPersistentStorageService>();
using (var storage = persistService.GetStorage(solution)) using var storage = persistService.GetStorage(solution);
{ stream.Position = 0;
stream.Position = 0; return await WriteStreamAsync(storage, value, stream, cancellationToken).ConfigureAwait(false);
return await WriteStreamAsync(storage, value, stream, cancellationToken).ConfigureAwait(false);
}
}
} }
protected readonly struct CacheEntry protected readonly struct CacheEntry
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册