Browse Source

"field can be readonly"

Nikita Tsukanov 10 years ago
parent
commit
3cd3579475
80 changed files with 147 additions and 147 deletions
  1. 3 3
      Tests/Perspex.Markup.Xaml.UnitTests/DataContextChangeSynchronizerTest.cs
  2. 2 2
      samples/TestApplication/Program.cs
  3. 1 1
      src/Gtk/Perspex.Cairo/CairoPlatform.cs
  4. 1 1
      src/Gtk/Perspex.Cairo/Media/DrawingContext.cs
  5. 3 3
      src/Gtk/Perspex.Cairo/Media/StreamGeometryContextImpl.cs
  6. 1 1
      src/Gtk/Perspex.Cairo/Media/StreamGeometryImpl.cs
  7. 1 1
      src/Gtk/Perspex.Cairo/Renderer.cs
  8. 1 1
      src/Gtk/Perspex.Gtk/GtkPlatform.cs
  9. 1 1
      src/Gtk/Perspex.Gtk/Input/GtkKeyboardDevice.cs
  10. 1 1
      src/Gtk/Perspex.Gtk/Input/GtkMouseDevice.cs
  11. 2 2
      src/Markup/Perspex.Markup.Xaml/DataBinding/XamlBindingDefinition.cs
  12. 2 2
      src/Perspex.Animation/Animation.cs
  13. 2 2
      src/Perspex.Animation/Animation`1.cs
  14. 1 1
      src/Perspex.Application/Application.cs
  15. 3 3
      src/Perspex.Base/PerspexObject.cs
  16. 4 4
      src/Perspex.Base/PerspexProperty.cs
  17. 2 2
      src/Perspex.Base/PriorityLevel.cs
  18. 5 5
      src/Perspex.Base/PriorityValue.cs
  19. 2 2
      src/Perspex.Base/Threading/Dispatcher.cs
  20. 1 1
      src/Perspex.Base/Threading/DispatcherTimer.cs
  21. 2 2
      src/Perspex.Base/Threading/MainLoop.cs
  22. 1 1
      src/Perspex.Controls/Control.cs
  23. 1 1
      src/Perspex.Controls/Generators/ItemContainerGenerator.cs
  24. 2 2
      src/Perspex.Controls/Generators/TreeItemContainerGenerator.cs
  25. 4 4
      src/Perspex.Controls/Grid.cs
  26. 2 2
      src/Perspex.Controls/GridLength.cs
  27. 1 1
      src/Perspex.Controls/MenuItemAccessKeyHandler.cs
  28. 1 1
      src/Perspex.Controls/Panel.cs
  29. 1 1
      src/Perspex.Controls/Presenters/TextPresenter.cs
  30. 2 2
      src/Perspex.Controls/Primitives/AdornerLayer.cs
  31. 1 1
      src/Perspex.Controls/Primitives/TemplatedControl.cs
  32. 1 1
      src/Perspex.Controls/Templates/DataTemplate.cs
  33. 1 1
      src/Perspex.Controls/Templates/FuncTemplate`1.cs
  34. 1 1
      src/Perspex.Controls/Templates/FuncTemplate`2.cs
  35. 2 2
      src/Perspex.Controls/Templates/TreeDataTemplate.cs
  36. 1 1
      src/Perspex.Controls/ToolTip.cs
  37. 6 6
      src/Perspex.Controls/TopLevel.cs
  38. 1 1
      src/Perspex.Diagnostics/DevTools.cs
  39. 2 2
      src/Perspex.Diagnostics/ViewModels/DevToolsViewModel.cs
  40. 1 1
      src/Perspex.Diagnostics/ViewModels/LogicalTreeViewModel.cs
  41. 1 1
      src/Perspex.Diagnostics/ViewModels/VisualTreeViewModel.cs
  42. 1 1
      src/Perspex.Input/AccessKeyHandler.cs
  43. 1 1
      src/Perspex.Input/FocusManager.cs
  44. 2 2
      src/Perspex.Input/InputManager.cs
  45. 1 1
      src/Perspex.Input/MouseDevice.cs
  46. 1 1
      src/Perspex.Interactivity/Interactive.cs
  47. 1 1
      src/Perspex.Interactivity/RoutedEvent.cs
  48. 3 3
      src/Perspex.Layout/LayoutManager.cs
  49. 1 1
      src/Perspex.Layout/Layoutable.cs
  50. 6 6
      src/Perspex.SceneGraph/Matrix.cs
  51. 1 1
      src/Perspex.SceneGraph/Media/PathMarkupParser.cs
  52. 1 1
      src/Perspex.SceneGraph/Media/StreamGeometryContext.cs
  53. 1 1
      src/Perspex.SceneGraph/Origin.cs
  54. 2 2
      src/Perspex.SceneGraph/Point.cs
  55. 4 4
      src/Perspex.SceneGraph/Rect.cs
  56. 1 1
      src/Perspex.SceneGraph/Rendering/RenderManager.cs
  57. 2 2
      src/Perspex.SceneGraph/Size.cs
  58. 4 4
      src/Perspex.SceneGraph/Thickness.cs
  59. 2 2
      src/Perspex.SceneGraph/Vector.cs
  60. 2 2
      src/Perspex.SceneGraph/Visual.cs
  61. 4 4
      src/Perspex.Styling/Styling/Classes.cs
  62. 3 3
      src/Perspex.Styling/Styling/Selector.cs
  63. 4 4
      src/Perspex.Styling/Styling/StyleActivator.cs
  64. 1 1
      src/Perspex.Styling/Styling/StyleBinding.cs
  65. 4 4
      src/Windows/Perspex.Direct2D1/Direct2D1Platform.cs
  66. 1 1
      src/Windows/Perspex.Direct2D1/Disposable.cs
  67. 1 1
      src/Windows/Perspex.Direct2D1/Media/DrawingContext.cs
  68. 1 1
      src/Windows/Perspex.Direct2D1/Media/Imaging/BitmapImpl.cs
  69. 1 1
      src/Windows/Perspex.Direct2D1/Media/Imaging/RenderTargetBitmapImpl.cs
  70. 3 3
      src/Windows/Perspex.Direct2D1/Media/PerspexTextRenderer.cs
  71. 1 1
      src/Windows/Perspex.Direct2D1/Media/StreamGeometryContextImpl.cs
  72. 1 1
      src/Windows/Perspex.Direct2D1/Media/StreamGeometryImpl.cs
  73. 1 1
      src/Windows/Perspex.Direct2D1/Renderer.cs
  74. 2 2
      src/Windows/Perspex.Win32/Input/KeyInterop.cs
  75. 2 2
      src/Windows/Perspex.Win32/Input/WindowsKeyboardDevice.cs
  76. 1 1
      src/Windows/Perspex.Win32/Input/WindowsMouseDevice.cs
  77. 2 2
      src/Windows/Perspex.Win32/Win32Platform.cs
  78. 1 1
      src/Windows/Perspex.Win32/WindowImpl.cs
  79. BIN
      tests/Perspex.RenderTests/Controls/ImageTests.cs
  80. 2 2
      tests/Perspex.Styling.UnitTests/TestSubject.cs

+ 3 - 3
Tests/Perspex.Markup.Xaml.UnitTests/DataContextChangeSynchronizerTest.cs

@@ -16,9 +16,9 @@ namespace Perspex.Xaml.Base.UnitTest
 {
     public class DataContextChangeSynchronizerTest
     {
-        private TypeConverterProvider _repo;
-        private SamplePerspexObject _guiObject;
-        private ViewModelMock _viewModel;
+        private readonly TypeConverterProvider _repo;
+        private readonly SamplePerspexObject _guiObject;
+        private readonly ViewModelMock _viewModel;
 
         public DataContextChangeSynchronizerTest()
         {

+ 2 - 2
samples/TestApplication/Program.cs

@@ -40,7 +40,7 @@ namespace TestApplication
 
     internal class Program
     {
-        private static PerspexList<Node> s_treeData = new PerspexList<Node>
+        private static readonly PerspexList<Node> s_treeData = new PerspexList<Node>
         {
             new Node
             {
@@ -78,7 +78,7 @@ namespace TestApplication
             },
         };
 
-        private static PerspexList<Item> s_listBoxData = new PerspexList<Item>
+        private static readonly PerspexList<Item> s_listBoxData = new PerspexList<Item>
         {
             new Item { Name = "Item 1", Value = "Item 1 Value" },
             new Item { Name = "Item 2", Value = "Item 2 Value" },

+ 1 - 1
src/Gtk/Perspex.Cairo/CairoPlatform.cs

@@ -14,7 +14,7 @@ namespace Perspex.Cairo
 
     public class CairoPlatform : IPlatformRenderInterface
     {
-        private static CairoPlatform s_instance = new CairoPlatform();
+        private static readonly CairoPlatform s_instance = new CairoPlatform();
 
         public static void Initialize()
         {

+ 1 - 1
src/Gtk/Perspex.Cairo/Media/DrawingContext.cs

@@ -19,7 +19,7 @@ namespace Perspex.Cairo.Media
         /// <summary>
         /// The cairo context.
         /// </summary>
-        private Cairo.Context _context;
+        private readonly Cairo.Context _context;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="DrawingContext"/> class.

+ 3 - 3
src/Gtk/Perspex.Cairo/Media/StreamGeometryContextImpl.cs

@@ -12,7 +12,7 @@ namespace Perspex.Cairo.Media
 
     public class StreamGeometryContextImpl : IStreamGeometryContextImpl
     {
-        private StreamGeometryImpl _impl;
+        private readonly StreamGeometryImpl _impl;
         public StreamGeometryContextImpl(StreamGeometryImpl imp)
         {
             _impl = imp;
@@ -39,8 +39,8 @@ namespace Perspex.Cairo.Media
             _context.LineTo(point.ToCairo());
         }
 
-        private Cairo.Context _context;
-        private Cairo.ImageSurface _surf;
+        private readonly Cairo.Context _context;
+        private readonly Cairo.ImageSurface _surf;
 
         public void EndFigure(bool isClosed)
         {

+ 1 - 1
src/Gtk/Perspex.Cairo/Media/StreamGeometryImpl.cs

@@ -36,7 +36,7 @@ namespace Perspex.Cairo.Media
             set;
         }
 
-        private StreamGeometryContextImpl _impl;
+        private readonly StreamGeometryContextImpl _impl;
 
         private Matrix _transform = Matrix.Identity;
         public Matrix Transform

+ 1 - 1
src/Gtk/Perspex.Cairo/Renderer.cs

@@ -17,7 +17,7 @@ namespace Perspex.Cairo
     /// </summary>
     public class Renderer : RendererBase
     {
-        private Surface _surface;
+        private readonly Surface _surface;
         private Gdk.Window _window;
 
         /// <summary>

+ 1 - 1
src/Gtk/Perspex.Gtk/GtkPlatform.cs

@@ -14,7 +14,7 @@ namespace Perspex.Gtk
 
     public class GtkPlatform : IPlatformThreadingInterface, IPlatformSettings
     {
-        private static GtkPlatform s_instance = new GtkPlatform();
+        private static readonly GtkPlatform s_instance = new GtkPlatform();
 
         public GtkPlatform()
         {

+ 1 - 1
src/Gtk/Perspex.Gtk/Input/GtkKeyboardDevice.cs

@@ -10,7 +10,7 @@ namespace Perspex.Gtk
 {
     public class GtkKeyboardDevice : KeyboardDevice
     {
-        private static GtkKeyboardDevice s_instance;
+        private static readonly GtkKeyboardDevice s_instance;
         private static readonly Dictionary<Gdk.Key, string> NameDic = new Dictionary<Gdk.Key, string>();
 
         static GtkKeyboardDevice()

+ 1 - 1
src/Gtk/Perspex.Gtk/Input/GtkMouseDevice.cs

@@ -6,7 +6,7 @@ namespace Perspex.Gtk
 {
     public class GtkMouseDevice : MouseDevice
     {
-        private static GtkMouseDevice s_instance;
+        private static readonly GtkMouseDevice s_instance;
 
         private Point _clientPosition;
 

+ 2 - 2
src/Markup/Perspex.Markup.Xaml/DataBinding/XamlBindingDefinition.cs

@@ -8,8 +8,8 @@ namespace Perspex.Markup.Xaml.DataBinding
 {
     public class XamlBindingDefinition
     {
-        private PropertyPath _sourcePropertyPath;
-        private BindingMode _bindingMode;
+        private readonly PropertyPath _sourcePropertyPath;
+        private readonly BindingMode _bindingMode;
         private readonly Control _target;
         private readonly PerspexProperty _targetProperty;
 

+ 2 - 2
src/Perspex.Animation/Animation.cs

@@ -13,12 +13,12 @@ namespace Perspex.Animation
         /// <summary>
         /// The animation being tracked.
         /// </summary>
-        private IObservable<object> _inner;
+        private readonly IObservable<object> _inner;
 
         /// <summary>
         /// The disposable used to cancel the animation.
         /// </summary>
-        private IDisposable _subscription;
+        private readonly IDisposable _subscription;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="Animation"/> class.

+ 2 - 2
src/Perspex.Animation/Animation`1.cs

@@ -14,12 +14,12 @@ namespace Perspex.Animation
         /// <summary>
         /// The animation being tracked.
         /// </summary>
-        private IObservable<T> _inner;
+        private readonly IObservable<T> _inner;
 
         /// <summary>
         /// The disposable used to cancel the animation.
         /// </summary>
-        private IDisposable _subscription;
+        private readonly IDisposable _subscription;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="Animation{T}"/> class.

+ 1 - 1
src/Perspex.Application/Application.cs

@@ -45,7 +45,7 @@ namespace Perspex
         /// <summary>
         /// The styler that will be used to apply styles to controls.
         /// </summary>
-        private Styler _styler = new Styler();
+        private readonly Styler _styler = new Styler();
 
         /// <summary>
         /// Initializes a new instance of the <see cref="Application"/> class.

+ 3 - 3
src/Perspex.Base/PerspexObject.cs

@@ -68,7 +68,7 @@ namespace Perspex
         /// <summary>
         /// The registered properties by type.
         /// </summary>
-        private static Dictionary<Type, List<PerspexProperty>> s_registered =
+        private static readonly Dictionary<Type, List<PerspexProperty>> s_registered =
             new Dictionary<Type, List<PerspexProperty>>();
 
         /// <summary>
@@ -79,7 +79,7 @@ namespace Perspex
         /// <summary>
         /// The set values/bindings on this object.
         /// </summary>
-        private Dictionary<PerspexProperty, PriorityValue> _values =
+        private readonly Dictionary<PerspexProperty, PriorityValue> _values =
             new Dictionary<PerspexProperty, PriorityValue>();
 
         /// <summary>
@@ -90,7 +90,7 @@ namespace Perspex
         /// <summary>
         /// A serilog logger for logging property events.
         /// </summary>
-        private ILogger _propertyLog;
+        private readonly ILogger _propertyLog;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="PerspexObject"/> class.

+ 4 - 4
src/Perspex.Base/PerspexProperty.cs

@@ -25,22 +25,22 @@ namespace Perspex
         /// <summary>
         /// The default values for the property, by type.
         /// </summary>
-        private Dictionary<Type, object> _defaultValues = new Dictionary<Type, object>();
+        private readonly Dictionary<Type, object> _defaultValues = new Dictionary<Type, object>();
 
         /// <summary>
         /// Observable fired when this property changes on any <see cref="PerspexObject"/>.
         /// </summary>
-        private Subject<PerspexPropertyChangedEventArgs> _initialized = new Subject<PerspexPropertyChangedEventArgs>();
+        private readonly Subject<PerspexPropertyChangedEventArgs> _initialized = new Subject<PerspexPropertyChangedEventArgs>();
 
         /// <summary>
         /// Observable fired when this property changes on any <see cref="PerspexObject"/>.
         /// </summary>
-        private Subject<PerspexPropertyChangedEventArgs> _changed = new Subject<PerspexPropertyChangedEventArgs>();
+        private readonly Subject<PerspexPropertyChangedEventArgs> _changed = new Subject<PerspexPropertyChangedEventArgs>();
 
         /// <summary>
         /// The validation functions for the property, by type.
         /// </summary>
-        private Dictionary<Type, Func<PerspexObject, object, object>> _validation =
+        private readonly Dictionary<Type, Func<PerspexObject, object, object>> _validation =
             new Dictionary<Type, Func<PerspexObject, object, object>>();
 
         /// <summary>

+ 2 - 2
src/Perspex.Base/PriorityLevel.cs

@@ -50,7 +50,7 @@ namespace Perspex
         /// <summary>
         /// Method called when current value changes.
         /// </summary>
-        private Action<PriorityLevel> _changed;
+        private readonly Action<PriorityLevel> _changed;
 
         /// <summary>
         /// The current direct value.
@@ -62,7 +62,7 @@ namespace Perspex
         /// </summary>
         private int _nextIndex;
 
-        private LevelPrecedenceMode _mode;
+        private readonly LevelPrecedenceMode _mode;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="PriorityLevel"/> class.

+ 5 - 5
src/Perspex.Base/PriorityValue.cs

@@ -27,22 +27,22 @@ namespace Perspex
         /// <summary>
         /// The name of the property.
         /// </summary>
-        private string _name;
+        private readonly string _name;
 
         /// <summary>
         /// The value type.
         /// </summary>
-        private Type _valueType;
+        private readonly Type _valueType;
 
         /// <summary>
         /// The currently registered bindings organised by priority.
         /// </summary>
-        private Dictionary<int, PriorityLevel> _levels = new Dictionary<int, PriorityLevel>();
+        private readonly Dictionary<int, PriorityLevel> _levels = new Dictionary<int, PriorityLevel>();
 
         /// <summary>
         /// The changed observable.
         /// </summary>
-        private Subject<Tuple<object, object>> _changed = new Subject<Tuple<object, object>>();
+        private readonly Subject<Tuple<object, object>> _changed = new Subject<Tuple<object, object>>();
 
         /// <summary>
         /// The current value.
@@ -52,7 +52,7 @@ namespace Perspex
         /// <summary>
         /// The function used to validate the value, if any.
         /// </summary>
-        private Func<object, object> _validate;
+        private readonly Func<object, object> _validate;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="PriorityValue"/> class.

+ 2 - 2
src/Perspex.Base/Threading/Dispatcher.cs

@@ -17,9 +17,9 @@ namespace Perspex.Threading
     /// </remarks>
     public class Dispatcher
     {
-        private static Dispatcher s_instance = new Dispatcher();
+        private static readonly Dispatcher s_instance = new Dispatcher();
 
-        private MainLoop _mainLoop = new MainLoop();
+        private readonly MainLoop _mainLoop = new MainLoop();
 
         /// <summary>
         /// Initializes a new instance of the <see cref="Dispatcher"/> class.

+ 1 - 1
src/Perspex.Base/Threading/DispatcherTimer.cs

@@ -15,7 +15,7 @@ namespace Perspex.Threading
     {
         private IDisposable _timer;
 
-        private DispatcherPriority _priority;
+        private readonly DispatcherPriority _priority;
 
         private TimeSpan _interval;
 

+ 2 - 2
src/Perspex.Base/Threading/MainLoop.cs

@@ -16,9 +16,9 @@ namespace Perspex.Win32.Threading
     /// </summary>
     internal class MainLoop
     {
-        private static IPlatformThreadingInterface s_platform;
+        private static readonly IPlatformThreadingInterface s_platform;
 
-        private PriorityQueue<Job, DispatcherPriority> _queue =
+        private readonly PriorityQueue<Job, DispatcherPriority> _queue =
             new PriorityQueue<Job, DispatcherPriority>(PriorityQueueType.Maximum);
 
         /// <summary>

+ 1 - 1
src/Perspex.Controls/Control.cs

@@ -67,7 +67,7 @@ namespace Perspex.Controls
         public static readonly RoutedEvent<RequestBringIntoViewEventArgs> RequestBringIntoViewEvent =
             RoutedEvent.Register<Control, RequestBringIntoViewEventArgs>("RequestBringIntoView", RoutingStrategies.Bubble);
 
-        private Classes _classes = new Classes();
+        private readonly Classes _classes = new Classes();
 
         private DataTemplates _dataTemplates;
 

+ 1 - 1
src/Perspex.Controls/Generators/ItemContainerGenerator.cs

@@ -17,7 +17,7 @@ namespace Perspex.Controls.Generators
     {
         private Dictionary<int, IControl> _containers = new Dictionary<int, IControl>();
 
-        private Subject<ItemContainers> _containersInitialized = new Subject<ItemContainers>();
+        private readonly Subject<ItemContainers> _containersInitialized = new Subject<ItemContainers>();
 
         /// <summary>
         /// Initializes a new instance of the <see cref="ItemContainerGenerator"/> class.

+ 2 - 2
src/Perspex.Controls/Generators/TreeItemContainerGenerator.cs

@@ -16,9 +16,9 @@ namespace Perspex.Controls.Generators
     /// <typeparam name="T">The type of the container.</typeparam>
     public class TreeItemContainerGenerator<T> : ITreeItemContainerGenerator where T : TreeViewItem, new()
     {
-        private Dictionary<object, T> _containers = new Dictionary<object, T>();
+        private readonly Dictionary<object, T> _containers = new Dictionary<object, T>();
 
-        private Subject<ItemContainers> _containersInitialized = new Subject<ItemContainers>();
+        private readonly Subject<ItemContainers> _containersInitialized = new Subject<ItemContainers>();
 
         /// <summary>
         /// Initializes a new instance of the <see cref="TreeItemContainerGenerator{T}"/> class.

+ 4 - 4
src/Perspex.Controls/Grid.cs

@@ -859,10 +859,10 @@ namespace Perspex.Controls
 
         private struct GridNode
         {
-            public int Row;
-            public int Column;
-            public double Size;
-            public Segment[,] Matrix;
+            public readonly int Row;
+            public readonly int Column;
+            public readonly double Size;
+            public readonly Segment[,] Matrix;
 
             public GridNode(Segment[,] matrix, int row, int col, double size)
             {

+ 2 - 2
src/Perspex.Controls/GridLength.cs

@@ -33,9 +33,9 @@ namespace Perspex.Controls
     /// </summary>
     public struct GridLength : IEquatable<GridLength>
     {
-        private GridUnitType _type;
+        private readonly GridUnitType _type;
 
-        private double _value;
+        private readonly double _value;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="GridLength"/> struct.

+ 1 - 1
src/Perspex.Controls/MenuItemAccessKeyHandler.cs

@@ -17,7 +17,7 @@ namespace Perspex.Controls
         /// <summary>
         /// The registered access keys.
         /// </summary>
-        private List<Tuple<string, IInputElement>> _registered = new List<Tuple<string, IInputElement>>();
+        private readonly List<Tuple<string, IInputElement>> _registered = new List<Tuple<string, IInputElement>>();
 
         /// <summary>
         /// The window to which the handler belongs.

+ 1 - 1
src/Perspex.Controls/Panel.cs

@@ -18,7 +18,7 @@ namespace Perspex.Controls
     /// </remarks>
     public class Panel : Control, IReparentingControl, IPanel
     {
-        private Controls _children = new Controls();
+        private readonly Controls _children = new Controls();
 
         private ILogical _childLogicalParent;
 

+ 1 - 1
src/Perspex.Controls/Presenters/TextPresenter.cs

@@ -21,7 +21,7 @@ namespace Perspex.Controls.Presenters
         public static readonly PerspexProperty<int> SelectionEndProperty =
             TextBox.SelectionEndProperty.AddOwner<TextPresenter>();
 
-        private DispatcherTimer _caretTimer;
+        private readonly DispatcherTimer _caretTimer;
 
         private bool _caretBlink;
 

+ 2 - 2
src/Perspex.Controls/Primitives/AdornerLayer.cs

@@ -14,10 +14,10 @@ namespace Perspex.Controls.Primitives
         public static PerspexProperty<Visual> AdornedElementProperty =
             PerspexProperty.RegisterAttached<AdornerLayer, Visual, Visual>("AdornedElement");
 
-        private static PerspexProperty<AdornedElementInfo> s_adornedElementInfoProperty =
+        private static readonly PerspexProperty<AdornedElementInfo> s_adornedElementInfoProperty =
             PerspexProperty.RegisterAttached<AdornerLayer, Visual, AdornedElementInfo>("AdornedElementInfo");
 
-        private BoundsTracker _tracker = new BoundsTracker();
+        private readonly BoundsTracker _tracker = new BoundsTracker();
 
         static AdornerLayer()
         {

+ 1 - 1
src/Perspex.Controls/Primitives/TemplatedControl.cs

@@ -74,7 +74,7 @@ namespace Perspex.Controls.Primitives
 
         private bool _templateApplied;
 
-        private ILogger _templateLog;
+        private readonly ILogger _templateLog;
 
         /// <summary>
         /// Initializes static members of the <see cref="TemplatedControl"/> class.

+ 1 - 1
src/Perspex.Controls/Templates/DataTemplate.cs

@@ -20,7 +20,7 @@ namespace Perspex.Controls.Templates
         /// <summary>
         /// The implementation of the <see cref="Match"/> method.
         /// </summary>
-        private Func<object, bool> _match;
+        private readonly Func<object, bool> _match;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="DataTemplate"/> class.

+ 1 - 1
src/Perspex.Controls/Templates/FuncTemplate`1.cs

@@ -11,7 +11,7 @@ namespace Perspex.Controls.Templates
     /// <typeparam name="TControl">The type of control.</typeparam>
     public class FuncTemplate<TControl> : ITemplate<TControl> where TControl : IControl
     {
-        private Func<TControl> _func;
+        private readonly Func<TControl> _func;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="FuncTemplate{TControl}"/> class.

+ 1 - 1
src/Perspex.Controls/Templates/FuncTemplate`2.cs

@@ -13,7 +13,7 @@ namespace Perspex.Controls.Templates
     public class FuncTemplate<TParam, TControl> : ITemplate<TParam, TControl>
         where TControl : IControl
     {
-        private Func<TParam, TControl> _func;
+        private readonly Func<TParam, TControl> _func;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="FuncTemplate{TControl, TParam}"/> class.

+ 2 - 2
src/Perspex.Controls/Templates/TreeDataTemplate.cs

@@ -12,9 +12,9 @@ namespace Perspex.Controls.Templates
     /// </summary>
     public class TreeDataTemplate : DataTemplate, ITreeDataTemplate
     {
-        private Func<object, IEnumerable> _itemsSelector;
+        private readonly Func<object, IEnumerable> _itemsSelector;
 
-        private Func<object, bool> _isExpanded;
+        private readonly Func<object, bool> _isExpanded;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="TreeDataTemplate"/> class.

+ 1 - 1
src/Perspex.Controls/ToolTip.cs

@@ -42,7 +42,7 @@ namespace Perspex.Controls
         /// observable is throttled and calls <see cref="ShowToolTip(Control)"/> when the time
         /// period expires.
         /// </summary>
-        private static Subject<Control> s_show = new Subject<Control>();
+        private static readonly Subject<Control> s_show = new Subject<Control>();
 
         /// <summary>
         /// Initializes static members of the <see cref="ToolTip"/> class.

+ 6 - 6
src/Perspex.Controls/TopLevel.cs

@@ -47,32 +47,32 @@ namespace Perspex.Controls
         /// <summary>
         /// The dispatcher for the window.
         /// </summary>
-        private Dispatcher _dispatcher;
+        private readonly Dispatcher _dispatcher;
 
         /// <summary>
         /// The render manager for the window.s
         /// </summary>
-        private IRenderManager _renderManager;
+        private readonly IRenderManager _renderManager;
 
         /// <summary>
         /// The window renderer.
         /// </summary>
-        private IRenderer _renderer;
+        private readonly IRenderer _renderer;
 
         /// <summary>
         /// The input manager for the window.
         /// </summary>
-        private IInputManager _inputManager;
+        private readonly IInputManager _inputManager;
 
         /// <summary>
         /// The access key handler for the window.
         /// </summary>
-        private IAccessKeyHandler _accessKeyHandler;
+        private readonly IAccessKeyHandler _accessKeyHandler;
 
         /// <summary>
         /// The access keyboard navigation handler for the window.
         /// </summary>
-        private IKeyboardNavigationHandler _keyboardNavigationHandler;
+        private readonly IKeyboardNavigationHandler _keyboardNavigationHandler;
 
         /// <summary>
         /// Initializes static members of the <see cref="TopLevel"/> class.

+ 1 - 1
src/Perspex.Diagnostics/DevTools.cs

@@ -15,7 +15,7 @@ namespace Perspex.Diagnostics
         public static readonly PerspexProperty<Control> RootProperty =
             PerspexProperty.Register<DevTools, Control>("Root");
 
-        private DevToolsViewModel _viewModel;
+        private readonly DevToolsViewModel _viewModel;
 
         public DevTools()
         {

+ 2 - 2
src/Perspex.Diagnostics/ViewModels/DevToolsViewModel.cs

@@ -17,9 +17,9 @@ namespace Perspex.Diagnostics.ViewModels
 
         private VisualTreeViewModel _visualTree;
 
-        private ObservableAsPropertyHelper<IInputElement> _focusedControl;
+        private readonly ObservableAsPropertyHelper<IInputElement> _focusedControl;
 
-        private ObservableAsPropertyHelper<IInputElement> _pointerOverElement;
+        private readonly ObservableAsPropertyHelper<IInputElement> _pointerOverElement;
 
         public DevToolsViewModel()
         {

+ 1 - 1
src/Perspex.Diagnostics/ViewModels/LogicalTreeViewModel.cs

@@ -11,7 +11,7 @@ namespace Perspex.Diagnostics.ViewModels
     {
         private LogicalTreeNode _selected;
 
-        private ObservableAsPropertyHelper<ControlDetailsViewModel> _details;
+        private readonly ObservableAsPropertyHelper<ControlDetailsViewModel> _details;
 
         public LogicalTreeViewModel(Control root)
         {

+ 1 - 1
src/Perspex.Diagnostics/ViewModels/VisualTreeViewModel.cs

@@ -11,7 +11,7 @@ namespace Perspex.Diagnostics.ViewModels
     {
         private VisualTreeNode _selected;
 
-        private ObservableAsPropertyHelper<ControlDetailsViewModel> _details;
+        private readonly ObservableAsPropertyHelper<ControlDetailsViewModel> _details;
 
         public VisualTreeViewModel(Control root)
         {

+ 1 - 1
src/Perspex.Input/AccessKeyHandler.cs

@@ -26,7 +26,7 @@ namespace Perspex.Input
         /// <summary>
         /// The registered access keys.
         /// </summary>
-        private List<Tuple<string, IInputElement>> _registered = new List<Tuple<string, IInputElement>>();
+        private readonly List<Tuple<string, IInputElement>> _registered = new List<Tuple<string, IInputElement>>();
 
         /// <summary>
         /// The window to which the handler belongs.

+ 1 - 1
src/Perspex.Input/FocusManager.cs

@@ -18,7 +18,7 @@ namespace Perspex.Input
         /// <summary>
         /// The focus scopes in which the focus is currently defined.
         /// </summary>
-        private Dictionary<IFocusScope, IInputElement> _focusScopes =
+        private readonly Dictionary<IFocusScope, IInputElement> _focusScopes =
             new Dictionary<IFocusScope, IInputElement>();
 
         /// <summary>

+ 2 - 2
src/Perspex.Input/InputManager.cs

@@ -12,9 +12,9 @@ namespace Perspex.Input
 {
     public class InputManager : IInputManager
     {
-        private Subject<RawInputEventArgs> _rawEventReceived = new Subject<RawInputEventArgs>();
+        private readonly Subject<RawInputEventArgs> _rawEventReceived = new Subject<RawInputEventArgs>();
 
-        private Subject<RawInputEventArgs> _postProcess = new Subject<RawInputEventArgs>();
+        private readonly Subject<RawInputEventArgs> _postProcess = new Subject<RawInputEventArgs>();
 
         public static IInputManager Instance => Locator.Current.GetService<IInputManager>();
 

+ 1 - 1
src/Perspex.Input/MouseDevice.cs

@@ -21,7 +21,7 @@ namespace Perspex.Input
 
         private uint _lastClickTime;
 
-        private List<IInputElement> _pointerOvers = new List<IInputElement>();
+        private readonly List<IInputElement> _pointerOvers = new List<IInputElement>();
 
         public MouseDevice()
         {

+ 1 - 1
src/Perspex.Interactivity/Interactive.cs

@@ -17,7 +17,7 @@ namespace Perspex.Interactivity
     /// </summary>
     public class Interactive : Layoutable, IInteractive
     {
-        private Dictionary<RoutedEvent, List<EventSubscription>> _eventHandlers =
+        private readonly Dictionary<RoutedEvent, List<EventSubscription>> _eventHandlers =
             new Dictionary<RoutedEvent, List<EventSubscription>>();
 
         /// <summary>

+ 1 - 1
src/Perspex.Interactivity/RoutedEvent.cs

@@ -18,7 +18,7 @@ namespace Perspex.Interactivity
 
     public class RoutedEvent
     {
-        private List<ClassEventSubscription> _subscriptions = new List<ClassEventSubscription>();
+        private readonly List<ClassEventSubscription> _subscriptions = new List<ClassEventSubscription>();
 
         public RoutedEvent(
             string name,

+ 3 - 3
src/Perspex.Layout/LayoutManager.cs

@@ -31,12 +31,12 @@ namespace Perspex.Layout
         /// <summary>
         /// Called when a layout is needed.
         /// </summary>
-        private Subject<Unit> _layoutNeeded;
+        private readonly Subject<Unit> _layoutNeeded;
 
         /// <summary>
         /// Called when a layout is completed.
         /// </summary>
-        private Subject<Unit> _layoutCompleted;
+        private readonly Subject<Unit> _layoutCompleted;
 
         /// <summary>
         /// Whether a measure is needed on the next layout pass.
@@ -61,7 +61,7 @@ namespace Perspex.Layout
         /// <summary>
         /// The logger to use.
         /// </summary>
-        private ILogger _log;
+        private readonly ILogger _log;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="LayoutManager"/> class.

+ 1 - 1
src/Perspex.Layout/Layoutable.cs

@@ -130,7 +130,7 @@ namespace Perspex.Layout
 
         private Rect? _previousArrange;
 
-        private ILogger _layoutLog;
+        private readonly ILogger _layoutLog;
 
         /// <summary>
         /// Initializes static members of the <see cref="Layoutable"/> class.

+ 6 - 6
src/Perspex.SceneGraph/Matrix.cs

@@ -11,12 +11,12 @@ namespace Perspex
     /// </summary>
     public struct Matrix
     {
-        private double _m11;
-        private double _m12;
-        private double _m21;
-        private double _m22;
-        private double _m31;
-        private double _m32;
+        private readonly double _m11;
+        private readonly double _m12;
+        private readonly double _m21;
+        private readonly double _m22;
+        private readonly double _m31;
+        private readonly double _m32;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="Matrix"/> struct.

+ 1 - 1
src/Perspex.SceneGraph/Media/PathMarkupParser.cs

@@ -34,7 +34,7 @@ namespace Perspex.Media
 
         private StreamGeometry _geometry;
 
-        private StreamGeometryContext _context;
+        private readonly StreamGeometryContext _context;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="PathMarkupParser"/> class.

+ 1 - 1
src/Perspex.SceneGraph/Media/StreamGeometryContext.cs

@@ -17,7 +17,7 @@ namespace Perspex.Media
     /// TODO: This class is just a wrapper around IStreamGeometryContextImpl: is it needed?
     public class StreamGeometryContext : IDisposable
     {
-        private IStreamGeometryContextImpl _impl;
+        private readonly IStreamGeometryContextImpl _impl;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="StreamGeometryContext"/> class.

+ 1 - 1
src/Perspex.SceneGraph/Origin.cs

@@ -31,7 +31,7 @@ namespace Perspex
 
         private Point _point;
 
-        private OriginUnit _unit;
+        private readonly OriginUnit _unit;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="Origin"/> struct.

+ 2 - 2
src/Perspex.SceneGraph/Point.cs

@@ -13,12 +13,12 @@ namespace Perspex
         /// <summary>
         /// The X position.
         /// </summary>
-        private double _x;
+        private readonly double _x;
 
         /// <summary>
         /// The Y position.
         /// </summary>
-        private double _y;
+        private readonly double _y;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="Point"/> structure.

+ 4 - 4
src/Perspex.SceneGraph/Rect.cs

@@ -14,22 +14,22 @@ namespace Perspex
         /// <summary>
         /// The X position.
         /// </summary>
-        private double _x;
+        private readonly double _x;
 
         /// <summary>
         /// The Y position.
         /// </summary>
-        private double _y;
+        private readonly double _y;
 
         /// <summary>
         /// The width.
         /// </summary>
-        private double _width;
+        private readonly double _width;
 
         /// <summary>
         /// The height.
         /// </summary>
-        private double _height;
+        private readonly double _height;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="Rect"/> structure.

+ 1 - 1
src/Perspex.SceneGraph/Rendering/RenderManager.cs

@@ -12,7 +12,7 @@ namespace Perspex.Rendering
     /// </summary>
     public class RenderManager : IRenderManager
     {
-        private Subject<Unit> _renderNeeded = new Subject<Unit>();
+        private readonly Subject<Unit> _renderNeeded = new Subject<Unit>();
 
         private bool _renderQueued;
 

+ 2 - 2
src/Perspex.SceneGraph/Size.cs

@@ -19,12 +19,12 @@ namespace Perspex
         /// <summary>
         /// The width.
         /// </summary>
-        private double _width;
+        private readonly double _width;
 
         /// <summary>
         /// The height.
         /// </summary>
-        private double _height;
+        private readonly double _height;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="Size"/> structure.

+ 4 - 4
src/Perspex.SceneGraph/Thickness.cs

@@ -14,22 +14,22 @@ namespace Perspex
         /// <summary>
         /// The thickness on the left.
         /// </summary>
-        private double _left;
+        private readonly double _left;
 
         /// <summary>
         /// The thickness on the top.
         /// </summary>
-        private double _top;
+        private readonly double _top;
 
         /// <summary>
         /// The thickness on the right.
         /// </summary>
-        private double _right;
+        private readonly double _right;
 
         /// <summary>
         /// The thickness on the bottom.
         /// </summary>
-        private double _bottom;
+        private readonly double _bottom;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="Thickness"/> structure.

+ 2 - 2
src/Perspex.SceneGraph/Vector.cs

@@ -14,12 +14,12 @@ namespace Perspex
         /// <summary>
         /// The X vector.
         /// </summary>
-        private double _x;
+        private readonly double _x;
 
         /// <summary>
         /// The Y vector.
         /// </summary>
-        private double _y;
+        private readonly double _y;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="Vector"/> structure.

+ 2 - 2
src/Perspex.SceneGraph/Visual.cs

@@ -73,7 +73,7 @@ namespace Perspex
         /// <summary>
         /// Holds the children of the visual.
         /// </summary>
-        private PerspexList<IVisual> _visualChildren;
+        private readonly PerspexList<IVisual> _visualChildren;
 
         /// <summary>
         /// Holds the parent of the visual.
@@ -88,7 +88,7 @@ namespace Perspex
         /// <summary>
         /// The logger for visual-level events.
         /// </summary>
-        private ILogger _visualLogger;
+        private readonly ILogger _visualLogger;
 
         /// <summary>
         /// Initializes static members of the <see cref="Visual"/> class.

+ 4 - 4
src/Perspex.Styling/Styling/Classes.cs

@@ -13,15 +13,15 @@ namespace Perspex.Styling
 {
     public class Classes : ICollection<string>, INotifyCollectionChanged
     {
-        private List<string> _inner;
+        private readonly List<string> _inner;
 
-        private Subject<NotifyCollectionChangedEventArgs> _beforeChanged
+        private readonly Subject<NotifyCollectionChangedEventArgs> _beforeChanged
             = new Subject<NotifyCollectionChangedEventArgs>();
 
-        private Subject<NotifyCollectionChangedEventArgs> _changed
+        private readonly Subject<NotifyCollectionChangedEventArgs> _changed
             = new Subject<NotifyCollectionChangedEventArgs>();
 
-        private Subject<NotifyCollectionChangedEventArgs> _afterChanged
+        private readonly Subject<NotifyCollectionChangedEventArgs> _afterChanged
             = new Subject<NotifyCollectionChangedEventArgs>();
 
         public Classes()

+ 3 - 3
src/Perspex.Styling/Styling/Selector.cs

@@ -8,11 +8,11 @@ namespace Perspex.Styling
 {
     public class Selector
     {
-        private Func<IStyleable, SelectorMatch> _evaluate;
+        private readonly Func<IStyleable, SelectorMatch> _evaluate;
 
-        private bool _inTemplate;
+        private readonly bool _inTemplate;
 
-        private bool _stopTraversal;
+        private readonly bool _stopTraversal;
 
         private string _description;
 

+ 4 - 4
src/Perspex.Styling/Styling/StyleActivator.cs

@@ -16,13 +16,13 @@ namespace Perspex.Styling
 
     public class StyleActivator : IObservable<bool>, IDisposable
     {
-        private ActivatorMode _mode;
+        private readonly ActivatorMode _mode;
 
-        private bool[] _values;
+        private readonly bool[] _values;
 
-        private List<IDisposable> _subscriptions = new List<IDisposable>();
+        private readonly List<IDisposable> _subscriptions = new List<IDisposable>();
 
-        private List<IObserver<bool>> _observers = new List<IObserver<bool>>();
+        private readonly List<IObserver<bool>> _observers = new List<IObserver<bool>>();
 
         public StyleActivator(
             IList<IObservable<bool>> inputs,

+ 1 - 1
src/Perspex.Styling/Styling/StyleBinding.cs

@@ -22,7 +22,7 @@ namespace Perspex.Styling
         /// <summary>
         /// The activator.
         /// </summary>
-        private IObservable<bool> _activator;
+        private readonly IObservable<bool> _activator;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="StyleBinding"/> class.

+ 4 - 4
src/Windows/Perspex.Direct2D1/Direct2D1Platform.cs

@@ -11,13 +11,13 @@ namespace Perspex.Direct2D1
 {
     public class Direct2D1Platform : IPlatformRenderInterface
     {
-        private static Direct2D1Platform s_instance = new Direct2D1Platform();
+        private static readonly Direct2D1Platform s_instance = new Direct2D1Platform();
 
-        private static SharpDX.Direct2D1.Factory s_d2D1Factory = new SharpDX.Direct2D1.Factory();
+        private static readonly SharpDX.Direct2D1.Factory s_d2D1Factory = new SharpDX.Direct2D1.Factory();
 
-        private static SharpDX.DirectWrite.Factory s_dwfactory = new SharpDX.DirectWrite.Factory();
+        private static readonly SharpDX.DirectWrite.Factory s_dwfactory = new SharpDX.DirectWrite.Factory();
 
-        private static SharpDX.WIC.ImagingFactory s_imagingFactory = new SharpDX.WIC.ImagingFactory();
+        private static readonly SharpDX.WIC.ImagingFactory s_imagingFactory = new SharpDX.WIC.ImagingFactory();
 
         public static void Initialize()
         {

+ 1 - 1
src/Windows/Perspex.Direct2D1/Disposable.cs

@@ -7,7 +7,7 @@ namespace Perspex.Direct2D1
 {
     public class Disposable<T> : IDisposable where T : IDisposable
     {
-        private IDisposable _extra;
+        private readonly IDisposable _extra;
 
         public Disposable(T inner)
         {

+ 1 - 1
src/Windows/Perspex.Direct2D1/Media/DrawingContext.cs

@@ -18,7 +18,7 @@ namespace Perspex.Direct2D1.Media
         /// <summary>
         /// The Direct2D1 render target.
         /// </summary>
-        private RenderTarget _renderTarget;
+        private readonly RenderTarget _renderTarget;
 
         /// <summary>
         /// The DirectWrite factory.

+ 1 - 1
src/Windows/Perspex.Direct2D1/Media/Imaging/BitmapImpl.cs

@@ -13,7 +13,7 @@ namespace Perspex.Direct2D1.Media
     /// </summary>
     public class BitmapImpl : IBitmapImpl
     {
-        private ImagingFactory _factory;
+        private readonly ImagingFactory _factory;
 
         private SharpDX.Direct2D1.Bitmap _direct2D;
 

+ 1 - 1
src/Windows/Perspex.Direct2D1/Media/Imaging/RenderTargetBitmapImpl.cs

@@ -10,7 +10,7 @@ namespace Perspex.Direct2D1.Media
 {
     public class RenderTargetBitmapImpl : BitmapImpl, IRenderTargetBitmapImpl, IDisposable
     {
-        private WicRenderTarget _target;
+        private readonly WicRenderTarget _target;
 
         public RenderTargetBitmapImpl(
             ImagingFactory imagingFactory,

+ 3 - 3
src/Windows/Perspex.Direct2D1/Media/PerspexTextRenderer.cs

@@ -10,11 +10,11 @@ namespace Perspex.Direct2D1.Media
 {
     internal class PerspexTextRenderer : TextRenderer
     {
-        private DrawingContext _context;
+        private readonly DrawingContext _context;
 
-        private RenderTarget _renderTarget;
+        private readonly RenderTarget _renderTarget;
 
-        private Brush _foreground;
+        private readonly Brush _foreground;
 
         public PerspexTextRenderer(
             DrawingContext context,

+ 1 - 1
src/Windows/Perspex.Direct2D1/Media/StreamGeometryContextImpl.cs

@@ -8,7 +8,7 @@ namespace Perspex.Direct2D1.Media
 {
     public class StreamGeometryContextImpl : IStreamGeometryContextImpl
     {
-        private GeometrySink _sink;
+        private readonly GeometrySink _sink;
 
         public StreamGeometryContextImpl(GeometrySink sink)
         {

+ 1 - 1
src/Windows/Perspex.Direct2D1/Media/StreamGeometryImpl.cs

@@ -14,7 +14,7 @@ namespace Perspex.Direct2D1.Media
     /// </summary>
     public class StreamGeometryImpl : GeometryImpl, IStreamGeometryImpl
     {
-        private PathGeometry _path;
+        private readonly PathGeometry _path;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="StreamGeometryImpl"/> class.

+ 1 - 1
src/Windows/Perspex.Direct2D1/Renderer.cs

@@ -18,7 +18,7 @@ namespace Perspex.Direct2D1
         /// <summary>
         /// The render target.
         /// </summary>
-        private RenderTarget _renderTarget;
+        private readonly RenderTarget _renderTarget;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="Renderer"/> class.

+ 2 - 2
src/Windows/Perspex.Win32/Input/KeyInterop.cs

@@ -10,7 +10,7 @@ namespace Perspex.Win32.Input
 {
     public static class KeyInterop
     {
-        private static Dictionary<Key, int> s_virtualKeyFromKey = new Dictionary<Key, int>
+        private static readonly Dictionary<Key, int> s_virtualKeyFromKey = new Dictionary<Key, int>
         {
             { Key.None, 0 },
             { Key.Cancel, 3 },
@@ -187,7 +187,7 @@ namespace Perspex.Win32.Input
             { Key.DeadCharProcessed, 0 },
         };
 
-        private static Dictionary<int, Key> s_keyFromVirtualKey = new Dictionary<int, Key>
+        private static readonly Dictionary<int, Key> s_keyFromVirtualKey = new Dictionary<int, Key>
         {
             { 0, Key.None },
             { 3, Key.Cancel },

+ 2 - 2
src/Windows/Perspex.Win32/Input/WindowsKeyboardDevice.cs

@@ -10,9 +10,9 @@ namespace Perspex.Win32.Input
 {
     public class WindowsKeyboardDevice : KeyboardDevice
     {
-        private static WindowsKeyboardDevice s_instance = new WindowsKeyboardDevice();
+        private static readonly WindowsKeyboardDevice s_instance = new WindowsKeyboardDevice();
 
-        private byte[] _keyStates = new byte[256];
+        private readonly byte[] _keyStates = new byte[256];
 
         public static new WindowsKeyboardDevice Instance => s_instance;
 

+ 1 - 1
src/Windows/Perspex.Win32/Input/WindowsMouseDevice.cs

@@ -10,7 +10,7 @@ namespace Perspex.Win32.Input
 {
     public class WindowsMouseDevice : MouseDevice
     {
-        private static WindowsMouseDevice s_instance = new WindowsMouseDevice();
+        private static readonly WindowsMouseDevice s_instance = new WindowsMouseDevice();
 
         public static new WindowsMouseDevice Instance => s_instance;
 

+ 2 - 2
src/Windows/Perspex.Win32/Win32Platform.cs

@@ -18,13 +18,13 @@ namespace Perspex.Win32
 {
     public class Win32Platform : IPlatformThreadingInterface, IPlatformSettings
     {
-        private static Win32Platform s_instance = new Win32Platform();
+        private static readonly Win32Platform s_instance = new Win32Platform();
 
         private UnmanagedMethods.WndProc _wndProcDelegate;
 
         private IntPtr _hwnd;
 
-        private List<Delegate> _delegates = new List<Delegate>();
+        private readonly List<Delegate> _delegates = new List<Delegate>();
 
         public Win32Platform()
         {

+ 1 - 1
src/Windows/Perspex.Win32/WindowImpl.cs

@@ -20,7 +20,7 @@ namespace Perspex.Win32
 {
     public class WindowImpl : IWindowImpl
     {
-        private static List<WindowImpl> s_instances = new List<WindowImpl>();
+        private static readonly List<WindowImpl> s_instances = new List<WindowImpl>();
 
         private static readonly IntPtr DefaultCursor = UnmanagedMethods.LoadCursor(
             IntPtr.Zero, new IntPtr((int)UnmanagedMethods.Cursor.IDC_ARROW));

BIN
tests/Perspex.RenderTests/Controls/ImageTests.cs


+ 2 - 2
tests/Perspex.Styling.UnitTests/TestSubject.cs

@@ -9,9 +9,9 @@ namespace Perspex.Styling.UnitTests
 {
     internal class TestSubject<T> : IObserver<T>, IObservable<T>
     {
-        private T _initial;
+        private readonly T _initial;
 
-        private List<IObserver<T>> _subscribers = new List<IObserver<T>>();
+        private readonly List<IObserver<T>> _subscribers = new List<IObserver<T>>();
 
         public TestSubject(T initial)
         {