Skip to content
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

private fields which are never re-assigned outside the constructor were made readonly #276

Merged
merged 1 commit into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Material.Demo/Models/SideSheetDemoViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Material.Demo.Models {
// Data context for sidesheet
public class SideSheetData : ViewModelBase {
private string _header = "SideSheet";
private readonly string _header = "SideSheet";
public string Header => _header;

public string ContentHeader { get; set; } = "What is Lorem Ipsum?";
Expand All @@ -14,7 +14,7 @@ public class SideSheetData : ViewModelBase {

// Data context for SideSheet demo page
public class SideSheetDemoViewModel : ViewModelBase {
private SideSheetData _information = new SideSheetData();
private readonly SideSheetData _information = new SideSheetData();

private bool _sideInfoOpened = false;
public SideSheetData Information => _information;
Expand Down
4 changes: 2 additions & 2 deletions Material.Demo/Pages/ProgressIndicatorDemo.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ namespace Material.Demo.Pages {
public partial class ProgressIndicatorDemo : UserControl {
private int caseProgress;

private Context context;
private Timer timer;
private readonly Context context;
private readonly Timer timer;

public ProgressIndicatorDemo() {
this.InitializeComponent();
Expand Down
2 changes: 1 addition & 1 deletion Material.Demo/ViewModels/ExpanderDemoViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Material.Demo.ViewModels
public class ExpanderDemoViewModel : ViewModelBase
{
public ObservableCollection<string> LoremText => _loremText;
private ObservableCollection<string> _loremText;
private readonly ObservableCollection<string> _loremText;

public ExpanderDemoViewModel()
{
Expand Down
4 changes: 2 additions & 2 deletions Material.Demo/ViewModels/RelayCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ namespace Material.Demo.ViewModels {
/// If you want to use this, you should copy all whole code and paste them to your new RelayCommand.cs source file.
/// </summary>
public class RelayCommand : ICommand {
private Func<object?, bool>? canExecute;
private Action<object?> execute;
private readonly Func<object?, bool>? canExecute;
private readonly Action<object?> execute;

public RelayCommand(Action<object?> execute, Func<object?, bool>? canExecute = null) {
this.execute = execute;
Expand Down
4 changes: 2 additions & 2 deletions Material.Dialog/Commands/MaterialDialogRelayCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ namespace Material.Dialog.Commands
/// </summary>
public class MaterialDialogRelayCommand : ICommand
{
private Action<object> execute;
private Func<object, bool> canExecute;
private readonly Action<object> execute;
private readonly Func<object, bool> canExecute;
public event EventHandler CanExecuteChanged;

public MaterialDialogRelayCommand(Action<object> execute, Func<object, bool> canExecute = null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public DialogButtonViewModel(DialogWindowViewModel parent, object content, IComm
_command = command;
}

private DialogWindowViewModel _parent;
private readonly DialogWindowViewModel _parent;

public DialogWindowViewModel Parent => _parent;

Expand Down