Modernized accessor syntax in several places (#13044)

* Modernized accessor syntax in several places

* Toned down the getter modernization

* Block body for properties with code

---------

Co-authored-by: Lehonti Ramos <lehonti@ramos>
This commit is contained in:
Lehonti Ramos
2023-10-06 04:54:38 +02:00
committed by GitHub
parent 54c573c16d
commit d1444b4f7c
15 changed files with 54 additions and 57 deletions
@@ -699,10 +699,10 @@ namespace Avalonia.Markup.UnitTests.Data
public double DoubleValue
{
get { return GetValue(DoubleValueProperty); }
set { SetValue(DoubleValueProperty, value); }
get => GetValue(DoubleValueProperty);
set => SetValue(DoubleValueProperty, value);
}
public static StyledProperty<double?> NullableDoubleProperty =
AvaloniaProperty.Register<StyledPropertyClass, double?>(nameof(NullableDoubleProperty), -1);
@@ -724,8 +724,8 @@ namespace Avalonia.Markup.UnitTests.Data
private double _doubleValue;
public double DoubleValue
{
get { return _doubleValue; }
set { SetAndRaise(DoubleValueProperty, ref _doubleValue, value); }
get => _doubleValue;
set => SetAndRaise(DoubleValueProperty, ref _doubleValue, value);
}
}
@@ -756,7 +756,7 @@ namespace Avalonia.Markup.UnitTests.Data
public double Value
{
get { return _value; }
get => _value;
set
{
if (_value != value)
@@ -788,8 +788,8 @@ namespace Avalonia.Markup.UnitTests.Data
public string TwoWay
{
get { return GetValue(TwoWayProperty); }
set { SetValue(TwoWayProperty, value); }
get => GetValue(TwoWayProperty);
set => SetValue(TwoWayProperty, value);
}
}
@@ -800,7 +800,7 @@ namespace Avalonia.Markup.UnitTests.Data
public string Foo
{
get { return _foo; }
get => _foo;
set
{
_foo = value;
@@ -911,8 +911,8 @@ namespace Avalonia.Markup.UnitTests.Data
public int Baz
{
get { return GetValue(BazProperty); }
set { SetValue(BazProperty, value); }
get => GetValue(BazProperty);
set => SetValue(BazProperty, value);
}
}
}
@@ -28,7 +28,7 @@ namespace Avalonia.Markup.UnitTests.Data
public string Foo
{
get { return _foo; }
get => _foo;
set
{
_foo = value;
@@ -158,8 +158,8 @@ namespace Avalonia.Markup.UnitTests.Parsers
public Class1 Next
{
get { return GetValue(NextProperty); }
set { SetValue(NextProperty, value); }
get => GetValue(NextProperty);
set => SetValue(NextProperty, value);
}
}
}
@@ -369,10 +369,7 @@ namespace Avalonia.Markup.UnitTests.Parsers
public string this[string key]
{
get
{
return _storage[key];
}
get => _storage[key];
set
{
_storage[key] = value;
@@ -115,9 +115,9 @@ namespace Avalonia.Markup.Xaml.UnitTests.Converters
public static readonly StyledProperty<string> FooProperty =
AvaloniaProperty.Register<Class1, string>("Foo");
public ThemeVariant ThemeVariant
public ThemeVariant ThemeVariant
{
get { throw new NotImplementedException(); }
get => throw new NotImplementedException();
}
public event EventHandler ThemeVariantChanged;
@@ -231,10 +231,7 @@ namespace Avalonia.Markup.Xaml.UnitTests.Data
object _parameter;
public object Parameter
{
get
{
return _parameter;
}
get => _parameter;
set
{
if (_parameter == value)
@@ -1949,10 +1949,7 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions
public string this[string key]
{
get
{
return _storage[key];
}
get => _storage[key];
set
{
_storage[key] = value;
@@ -1991,10 +1988,7 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions
object _parameter;
public object Parameter
{
get
{
return _parameter;
}
get => _parameter;
set
{
if (_parameter == value)
@@ -2050,8 +2044,8 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions
private IEnumerable _items;
public IEnumerable Items
{
get { return _items; }
set { SetAndRaise(ItemsProperty, ref _items, value); }
get => _items;
set => SetAndRaise(ItemsProperty, ref _items, value);
}
public AvaloniaList<DataGridLikeColumn> Columns { get; } = new();
@@ -12,14 +12,14 @@ namespace Avalonia.Markup.Xaml.UnitTests
public int Int
{
get { return GetValue(IntProperty); }
set { SetValue(IntProperty, value); }
get => GetValue(IntProperty);
set => SetValue(IntProperty, value);
}
public string String
{
get { return GetValue(StringProperty); }
set { SetValue(StringProperty, value); }
get => GetValue(StringProperty);
set => SetValue(StringProperty, value);
}
}
}
}
@@ -10,7 +10,7 @@ namespace Avalonia.Markup.Xaml.UnitTests
public int Integer
{
get { return _integer; }
get => _integer;
set
{
_integer = value;
@@ -20,7 +20,7 @@ namespace Avalonia.Markup.Xaml.UnitTests
public string String
{
get { return _string; }
get => _string;
set
{
_string = value;
@@ -30,7 +30,7 @@ namespace Avalonia.Markup.Xaml.UnitTests
public TestViewModel Child
{
get { return _child; }
get => _child;
set
{
_child = value;
@@ -990,7 +990,7 @@ namespace Avalonia.Markup.Xaml.UnitTests.Xaml
public IList SelectedItems
{
get { return _selectedItems; }
get => _selectedItems;
set
{
_selectedItems = value;
@@ -20,19 +20,16 @@ namespace Avalonia.Markup.Xaml.UnitTests.Xaml
public Control Control
{
get { return GetValue(ControlProperty); }
set { SetValue(ControlProperty, value); }
get => GetValue(ControlProperty);
set => SetValue(ControlProperty, value);
}
public string String
{
get { return GetValue(StringProperty); }
set { SetValue(StringProperty, value); }
get => GetValue(StringProperty);
set => SetValue(StringProperty, value);
}
public string Bar
{
get { return GetValue(BarProperty); }
}
public string Bar => GetValue(BarProperty);
}
}
@@ -37,8 +37,8 @@ namespace Avalonia.ReactiveUI.UnitTests
public string Foo
{
get { return GetValue(FooProperty); }
set { SetValue(FooProperty, value); }
get => GetValue(FooProperty);
set => SetValue(FooProperty, value);
}
}
}
@@ -21,12 +21,18 @@ namespace Avalonia.Direct2D1.RenderTests.Media
private string BitmapPath
{
get { return System.IO.Path.Combine(OutputPath, "github_icon.png"); }
get
{
return System.IO.Path.Combine(OutputPath, "github_icon.png");
}
}
private string SmallBitmapPath
{
get { return System.IO.Path.Combine(OutputPath, "github_icon_small.png"); }
get
{
return System.IO.Path.Combine(OutputPath, "github_icon_small.png");
}
}
[Fact]
@@ -19,7 +19,10 @@ namespace Avalonia.Direct2D1.RenderTests.Media
private string BitmapPath
{
get { return System.IO.Path.Combine(OutputPath, "github_icon.png"); }
get
{
return System.IO.Path.Combine(OutputPath, "github_icon.png");
}
}
[Fact]
@@ -21,7 +21,10 @@ namespace Avalonia.Direct2D1.RenderTests.Media
private string BitmapPath
{
get { return System.IO.Path.Combine(OutputPath, "github_icon.png"); }
get
{
return System.IO.Path.Combine(OutputPath, "github_icon.png");
}
}
private Control Visual