-
Notifications
You must be signed in to change notification settings - Fork 779
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add readonly
modifier to fields
#876
Add readonly
modifier to fields
#876
Conversation
Made several fields `readonly` based on Code QL suggestions (Caliburn-Micro#875). This ensures they are only assigned during declaration or inside constructors. Affected files: - src/Caliburn.Micro.Core/SimpleContainer.cs - src/Caliburn.Micro.Platform/Bind.cs - src/Caliburn.Micro.Platform/Platforms/Maui/Windows/MauiPlatformProvider.cs - src/Caliburn.Micro.Platform/Platforms/uap/FrameAdapter.cs - src/Caliburn.Micro.Platform/Platforms/uap/XamlMetadataProvider.cs - src/Caliburn.Micro.Platform/XamlPlatformProvider.cs
readonly
modifier to fieldsreadonly
modifier to fields
@@ -15,7 +15,7 @@ public class SimpleContainer | |||
private static readonly Type enumerableType = typeof(IEnumerable); | |||
private static readonly TypeInfo enumerableTypeInfo = enumerableType.GetTypeInfo(); | |||
private static readonly TypeInfo delegateTypeInfo = delegateType.GetTypeInfo(); | |||
private Type simpleContainerType = typeof(SimpleContainer); | |||
private readonly Type simpleContainerType = typeof(SimpleContainer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
@@ -53,7 +53,7 @@ public static class Bind { | |||
null, | |||
ModelWithoutContextChanged); | |||
|
|||
internal static DependencyProperty NoContextProperty = | |||
internal static readonly DependencyProperty NoContextProperty = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
@@ -17,7 +17,7 @@ namespace Caliburn.Micro | |||
public class FrameAdapter : INavigationService, IDisposable | |||
{ | |||
#if WINDOWS_UWP | |||
private SystemNavigationManager navigationManager; | |||
private readonly SystemNavigationManager navigationManager; | |||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
private Dictionary<string, IXamlType> _xamlTypes = new Dictionary<string, IXamlType>(); | ||
private Dictionary<string, IXamlMember> _xamlMembers = new Dictionary<string, IXamlMember>(); | ||
private Dictionary<Type, string> _xamlTypeToStandardName = new Dictionary<Type, string>(); | ||
private readonly Dictionary<string, IXamlType> _xamlTypes = new Dictionary<string, IXamlType>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
@@ -152,8 +152,8 @@ internal class XamlTypeInfoProvider { | |||
|
|||
|
|||
internal class XamlSystemBaseType : IXamlType { | |||
private string _fullName; | |||
private Type _underlyingType; | |||
private readonly string _fullName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
private string _fullName; | ||
private Type _underlyingType; | ||
private readonly string _fullName; | ||
private readonly Type _underlyingType; | ||
|
||
public XamlSystemBaseType(string fullName, Type underlyingType) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
@@ -17,9 +17,9 @@ | |||
/// </summary> | |||
public class XamlPlatformProvider : IPlatformProvider { | |||
#if WINDOWS_UWP | |||
private CoreDispatcher dispatcher; | |||
private readonly CoreDispatcher dispatcher; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
#else | ||
private Dispatcher dispatcher; | ||
private readonly Dispatcher dispatcher; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
Made several fields
readonly
based on Code QL suggestions (#875). This ensures they are only assigned during declaration or inside constructors.Affected files: