From 8df9f27ac3dd6c8ab1fcc652eb7e81f2202b9d61 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 28 Jun 2019 15:39:01 -0700 Subject: [PATCH] Use var --- .../Sessions/CurlyBraceCompletionSession.cs | 2 +- .../CSharp/DecompiledSource/AssemblyResolver.cs | 4 ++-- .../CSharp/DecompiledSource/CSharpDecompiledSourceService.cs | 4 ++-- .../CSharp/LineSeparators/CSharpLineSeparatorService.cs | 2 +- .../CSharp/NavigationBar/CSharpNavigationBarItemService.cs | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/EditorFeatures/CSharp/AutomaticCompletion/Sessions/CurlyBraceCompletionSession.cs b/src/EditorFeatures/CSharp/AutomaticCompletion/Sessions/CurlyBraceCompletionSession.cs index 1664edd86e5..994fdec41cc 100644 --- a/src/EditorFeatures/CSharp/AutomaticCompletion/Sessions/CurlyBraceCompletionSession.cs +++ b/src/EditorFeatures/CSharp/AutomaticCompletion/Sessions/CurlyBraceCompletionSession.cs @@ -93,7 +93,7 @@ private static bool ContainsOnlyWhitespace(IBraceCompletionSession session) return false; } - for (int i = start; i <= end; i++) + for (var i = start; i <= end; i++) { if (!char.IsWhiteSpace(snapshot[i])) { diff --git a/src/EditorFeatures/CSharp/DecompiledSource/AssemblyResolver.cs b/src/EditorFeatures/CSharp/DecompiledSource/AssemblyResolver.cs index ede9ce90b2d..641086c6878 100644 --- a/src/EditorFeatures/CSharp/DecompiledSource/AssemblyResolver.cs +++ b/src/EditorFeatures/CSharp/DecompiledSource/AssemblyResolver.cs @@ -57,8 +57,8 @@ public PEFile ResolveModule(PEFile mainModule, string moduleName) { // Primitive implementation to support multi-module assemblies // where all modules are located next to the main module. - string baseDirectory = Path.GetDirectoryName(mainModule.FileName); - string moduleFileName = Path.Combine(baseDirectory, moduleName); + var baseDirectory = Path.GetDirectoryName(mainModule.FileName); + var moduleFileName = Path.Combine(baseDirectory, moduleName); if (!File.Exists(moduleFileName)) { return null; diff --git a/src/EditorFeatures/CSharp/DecompiledSource/CSharpDecompiledSourceService.cs b/src/EditorFeatures/CSharp/DecompiledSource/CSharpDecompiledSourceService.cs index 99edc1e8f02..490929039df 100644 --- a/src/EditorFeatures/CSharp/DecompiledSource/CSharpDecompiledSourceService.cs +++ b/src/EditorFeatures/CSharp/DecompiledSource/CSharpDecompiledSourceService.cs @@ -108,9 +108,9 @@ private Document PerformDecompilation(Document document, string fullName, Compil private async Task AddAssemblyInfoRegionAsync(Document document, ISymbol symbol, CancellationToken cancellationToken) { - string assemblyInfo = MetadataAsSourceHelpers.GetAssemblyInfo(symbol.ContainingAssembly); + var assemblyInfo = MetadataAsSourceHelpers.GetAssemblyInfo(symbol.ContainingAssembly); var compilation = await document.Project.GetCompilationAsync(cancellationToken).ConfigureAwait(false); - string assemblyPath = MetadataAsSourceHelpers.GetAssemblyDisplay(compilation, symbol.ContainingAssembly); + var assemblyPath = MetadataAsSourceHelpers.GetAssemblyDisplay(compilation, symbol.ContainingAssembly); var regionTrivia = SyntaxFactory.RegionDirectiveTrivia(true) .WithTrailingTrivia(new[] { SyntaxFactory.Space, SyntaxFactory.PreprocessingMessage(assemblyInfo) }); diff --git a/src/EditorFeatures/CSharp/LineSeparators/CSharpLineSeparatorService.cs b/src/EditorFeatures/CSharp/LineSeparators/CSharpLineSeparatorService.cs index bb31741c894..0a617cfa84c 100644 --- a/src/EditorFeatures/CSharp/LineSeparators/CSharpLineSeparatorService.cs +++ b/src/EditorFeatures/CSharp/LineSeparators/CSharpLineSeparatorService.cs @@ -277,7 +277,7 @@ private static void ProcessUsings(SyntaxList usings, List< // first child needs no separator var seenSeparator = true; - for (int i = 0; i < children.Count - 1; i++) + for (var i = 0; i < children.Count - 1; i++) { cancellationToken.ThrowIfCancellationRequested(); diff --git a/src/EditorFeatures/CSharp/NavigationBar/CSharpNavigationBarItemService.cs b/src/EditorFeatures/CSharp/NavigationBar/CSharpNavigationBarItemService.cs index 528d643dd7a..37cc600e765 100644 --- a/src/EditorFeatures/CSharp/NavigationBar/CSharpNavigationBarItemService.cs +++ b/src/EditorFeatures/CSharp/NavigationBar/CSharpNavigationBarItemService.cs @@ -251,8 +251,8 @@ private static void AddFieldSpan(ISymbol symbol, SyntaxTree tree, List var declaringNode = reference.GetSyntax(); - int spanStart = declaringNode.SpanStart; - int spanEnd = declaringNode.Span.End; + var spanStart = declaringNode.SpanStart; + var spanEnd = declaringNode.Span.End; var fieldDeclaration = declaringNode.GetAncestor(); if (fieldDeclaration != null) -- GitLab