Repository: veler/DevToys
File: src/dev/impl/DevToys/ViewModels/Tools/JsonFormatter/JsonFormatterToolViewModel.cs (C#)

Code before:
        /// <summary>
        /// Gets or sets the desired indentation.
        /// </summary>
        internal Indentation IndentationMode
        {
            get
            {
                Indentations settingsValue = SettingsProvider.GetSetting(Indentation);
                var indentation = Indentations.FirstOrDefault(x => x.Value == settingsValue);
                return indentation ?? Models.Indentation.TwoSpaces;
            }
            set
            {
                if (!IndentationMode.Equals(value))
                {
                    SettingsProvider.SetSetting(Indentation, value.Value);
                    OnPropertyChanged();
                    QueueFormatting();
                }
            }
        }

        /// <summary>
        /// Get a list of supported Indentation
        /// </summary>
        internal ObservableCollection<Indentation> Indentations => new ObservableCollection<Indentation> {
            Models.Indentation.TwoSpaces,
            Models.Indentation.FourSpaces,
            Models.Indentation.OneTab,
            Models.Indentation.Minified,
        };

        /// <summary>
        /// Gets or sets the input text.
        /// </summary>
        internal string? InputValue
        {
            get => _inputValue;
            set
            {
                SetProperty(ref _inputValue, value);
                QueueFormatting();
            }
        }

        internal string? OutputValue
        {
            get => _outputValue;
            set => SetProperty(ref _outputValue, value);
        }


Review comment (suggestion):
Do not use `=>` in this scenario. Using `=>` would instantiate a new ObservableCollection every time we Get this property. Since this collection isn't supposed to change, use `=` instead.

```
internal ObservableCollection<Indentation> Indentations { get; }
    = new ObservableCollection
```

Also, since the collection will never change, we can probably use a IReadOnlyList instead of ObservableCollection.

```
internal IReadOnlyList<Indentation> Indentations { get; }
    = new Indentation[]
        {
              // ...
        }
```

Code after:
        /// Gets or sets the desired indentation.
        /// </summary>
        internal IndentationDisplayPair IndentationMode
        {
            get
            {
                Indentation settingsValue = SettingsProvider.GetSetting(Indentation);
                var indentation = Indentations.FirstOrDefault(x => x.Value == settingsValue);
                return indentation ?? Models.IndentationDisplayPair.TwoSpaces;
            }
            set
            {
                if (!IndentationMode.Equals(value))
                {
                    SettingsProvider.SetSetting(Indentation, value.Value);
                    OnPropertyChanged();
                    QueueFormatting();
                }
            }
        }

        /// <summary>
        /// Get a list of supported Indentation
        /// </summary>
        internal IReadOnlyList<IndentationDisplayPair> Indentations = new ObservableCollection<IndentationDisplayPair> {
            Models.IndentationDisplayPair.TwoSpaces,
            Models.IndentationDisplayPair.FourSpaces,
            Models.IndentationDisplayPair.OneTab,
            Models.IndentationDisplayPair.Minified,
        };

        /// <summary>
        /// Gets or sets the input text.
        /// </summary>
        internal string? InputValue
        {
            get => _inputValue;
            set
            {
                SetProperty(ref _inputValue, value);
                QueueFormatting();
            }
        }

        internal string? OutputValue
        {
            get => _outputValue;
            set => SetProperty(ref _outputValue, value);
        }

        internal ISettingsProvider SettingsProvider { get; }