From 8a0356bc5adb9fb42dc5fc0d55b902391623b44f Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 7 May 2019 12:29:17 -0700 Subject: [PATCH] Use simple 'using' statement --- .../State/AbstractAnalyzerState.cs | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/Features/Core/Portable/SolutionCrawler/State/AbstractAnalyzerState.cs b/src/Features/Core/Portable/SolutionCrawler/State/AbstractAnalyzerState.cs index 9a32ea8a2ea..08afa5cf157 100644 --- a/src/Features/Core/Portable/SolutionCrawler/State/AbstractAnalyzerState.cs +++ b/src/Features/Core/Portable/SolutionCrawler/State/AbstractAnalyzerState.cs @@ -93,19 +93,15 @@ public virtual bool Remove(TKey id) private async Task WriteToStreamAsync(TValue value, TData data, CancellationToken cancellationToken) { - using (var stream = SerializableBytes.CreateWritableStream()) - { - WriteTo(stream, data, cancellationToken); + using var stream = SerializableBytes.CreateWritableStream(); + WriteTo(stream, data, cancellationToken); - var solution = GetSolution(value); - var persistService = solution.Workspace.Services.GetService(); + var solution = GetSolution(value); + var persistService = solution.Workspace.Services.GetService(); - using (var storage = persistService.GetStorage(solution)) - { - stream.Position = 0; - return await WriteStreamAsync(storage, value, stream, cancellationToken).ConfigureAwait(false); - } - } + using var storage = persistService.GetStorage(solution); + stream.Position = 0; + return await WriteStreamAsync(storage, value, stream, cancellationToken).ConfigureAwait(false); } protected readonly struct CacheEntry -- GitLab