-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Modernized accessor syntax in several places #13044
Conversation
You can test this PR using the following package version. |
{ | ||
get { return System.IO.Path.Combine(OutputPath, "github_icon.png"); } | ||
} | ||
private string BitmapPath => System.IO.Path.Combine(OutputPath, "github_icon.png"); |
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.
IMO this is a step too far. It's less easy to read. The below would have been enough. Yes, this is dev preference which is why I would change less actually. Other people will have different opinions I'm sure.
private string BitmapPath
{
get => System.IO.Path.Combine(OutputPath, "github_icon.png");
}
|
||
private Control Visual | ||
private Control Visual => new Panel |
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.
If there is a code block in a getter you really shouldn't be "modernizing" it IMO. It is entirely developer preference in that case.
Hi @robloo I just toned down the changes a little. Specifically, the getters that perform calculations are back to having block bodies. See if you like this updated version better. |
You can test this PR using the following package version. |
get { return System.IO.Path.Combine(OutputPath, "github_icon.png"); } | ||
get | ||
{ | ||
return System.IO.Path.Combine(OutputPath, "github_icon.png"); |
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.
To be clear these one-liners make sense to use get => System.IO.Path.Combine(OutputPath, "github_icon.png");
I was referring to the cases where there are multiple lines of code and the cases where you removed the get
accessor entirely.
You can test this PR using the following package version. |
What does the pull request do?
Modernizes syntax of single-expression
get
ters andset
ters in several files of:Avalonia.Markup.UnitTests
Avalonia.Markup.Xaml.UnitTests
Avalonia.ReactiveUI.UnitTests
Avalonia.RenderTests
What is the updated/expected behavior with this PR?
No behavior change