提交 63339b3d 编写于 作者: C Cyrus Najmabadi

Make fields readonly

上级 5807a4c2
...@@ -29,7 +29,7 @@ internal partial class Dashboard : UserControl, IDisposable ...@@ -29,7 +29,7 @@ internal partial class Dashboard : UserControl, IDisposable
internal bool ShouldReceiveKeyboardNavigation { get; set; } internal bool ShouldReceiveKeyboardNavigation { get; set; }
private IEnumerable<string> _renameAccessKeys = new[] private readonly IEnumerable<string> _renameAccessKeys = new[]
{ {
RenameShortcutKey.RenameOverloads, RenameShortcutKey.RenameOverloads,
RenameShortcutKey.SearchInComments, RenameShortcutKey.SearchInComments,
......
...@@ -50,7 +50,7 @@ internal partial class InlineRenameSession : ForegroundThreadAffinitizedObject, ...@@ -50,7 +50,7 @@ internal partial class InlineRenameSession : ForegroundThreadAffinitizedObject,
private bool _isApplyingEdit; private bool _isApplyingEdit;
private string _replacementText; private string _replacementText;
private OptionSet _optionSet; private OptionSet _optionSet;
private Dictionary<ITextBuffer, OpenTextBufferManager> _openTextBuffers = new Dictionary<ITextBuffer, OpenTextBufferManager>(); private readonly Dictionary<ITextBuffer, OpenTextBufferManager> _openTextBuffers = new Dictionary<ITextBuffer, OpenTextBufferManager>();
/// <summary> /// <summary>
/// If non-null, the current text of the replacement. Linked spans added will automatically be updated with this /// If non-null, the current text of the replacement. Linked spans added will automatically be updated with this
......
...@@ -10,7 +10,7 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.NavigateTo ...@@ -10,7 +10,7 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.NavigateTo
[ExportWorkspaceServiceFactory(typeof(INavigateToPreviewService), ServiceLayer.Editor), Shared] [ExportWorkspaceServiceFactory(typeof(INavigateToPreviewService), ServiceLayer.Editor), Shared]
internal sealed class DefaultNavigateToPreviewServiceFactory : IWorkspaceServiceFactory internal sealed class DefaultNavigateToPreviewServiceFactory : IWorkspaceServiceFactory
{ {
private Lazy<INavigateToPreviewService> _singleton = private readonly Lazy<INavigateToPreviewService> _singleton =
new Lazy<INavigateToPreviewService>(() => new DefaultNavigateToPreviewService()); new Lazy<INavigateToPreviewService>(() => new DefaultNavigateToPreviewService());
public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices)
......
...@@ -13,7 +13,7 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.Notification ...@@ -13,7 +13,7 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.Notification
[Shared] [Shared]
internal class EditorNotificationServiceFactory : IWorkspaceServiceFactory internal class EditorNotificationServiceFactory : IWorkspaceServiceFactory
{ {
private static object s_gate = new object(); private static readonly object s_gate = new object();
private static EditorDialogService s_singleton; private static EditorDialogService s_singleton;
......
...@@ -15,7 +15,7 @@ internal sealed partial class LegacyEditorConfigDocumentOptionsProvider : IDocum ...@@ -15,7 +15,7 @@ internal sealed partial class LegacyEditorConfigDocumentOptionsProvider : IDocum
{ {
private class DocumentOptions : IDocumentOptions private class DocumentOptions : IDocumentOptions
{ {
private ICodingConventionsSnapshot _codingConventionSnapshot; private readonly ICodingConventionsSnapshot _codingConventionSnapshot;
private readonly IErrorLoggerService _errorLogger; private readonly IErrorLoggerService _errorLogger;
private static readonly ConditionalWeakTable<IReadOnlyDictionary<string, object>, IReadOnlyDictionary<string, string>> s_convertedDictionaryCache = private static readonly ConditionalWeakTable<IReadOnlyDictionary<string, object>, IReadOnlyDictionary<string, string>> s_convertedDictionaryCache =
new ConditionalWeakTable<IReadOnlyDictionary<string, object>, IReadOnlyDictionary<string, string>>(); new ConditionalWeakTable<IReadOnlyDictionary<string, object>, IReadOnlyDictionary<string, string>>();
......
...@@ -35,7 +35,7 @@ internal abstract partial class AbstractStructureTaggerProvider<TRegionTag> : ...@@ -35,7 +35,7 @@ internal abstract partial class AbstractStructureTaggerProvider<TRegionTag> :
AsynchronousTaggerProvider<TRegionTag> AsynchronousTaggerProvider<TRegionTag>
where TRegionTag : class, ITag where TRegionTag : class, ITag
{ {
private static IComparer<BlockSpan> s_blockSpanComparer = private static readonly IComparer<BlockSpan> s_blockSpanComparer =
Comparer<BlockSpan>.Create((s1, s2) => s1.TextSpan.Start - s2.TextSpan.Start); Comparer<BlockSpan>.Create((s1, s2) => s1.TextSpan.Start - s2.TextSpan.Start);
protected readonly ITextEditorFactoryService TextEditorFactoryService; protected readonly ITextEditorFactoryService TextEditorFactoryService;
......
...@@ -25,7 +25,7 @@ namespace Microsoft.CodeAnalysis.SymbolSearch ...@@ -25,7 +25,7 @@ namespace Microsoft.CodeAnalysis.SymbolSearch
/// </summary> /// </summary>
internal partial class SymbolSearchUpdateEngine : ISymbolSearchUpdateEngine internal partial class SymbolSearchUpdateEngine : ISymbolSearchUpdateEngine
{ {
private ConcurrentDictionary<string, IAddReferenceDatabaseWrapper> _sourceToDatabase = private readonly ConcurrentDictionary<string, IAddReferenceDatabaseWrapper> _sourceToDatabase =
new ConcurrentDictionary<string, IAddReferenceDatabaseWrapper>(); new ConcurrentDictionary<string, IAddReferenceDatabaseWrapper>();
public SymbolSearchUpdateEngine( public SymbolSearchUpdateEngine(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册