Skip to content

Commit

Permalink
Merge pull request #276 from Lehonti/master
Browse files Browse the repository at this point in the history
`private` fields which are never re-assigned outside the constructor were made `readonly`
  • Loading branch information
SKProCH committed Aug 9, 2023
2 parents dfe24c6 + c26d146 commit 0b4c1dd
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
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

0 comments on commit 0b4c1dd

Please sign in to comment.