From b6e95c13d239d5b3a3349fc4307119eeeaa37f27 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Mon, 25 Nov 2024 20:35:14 +0000 Subject: [PATCH] refactor: use expression bodied accessors where possible Getters and setters with a single statement in their bodies can be simplified using the arrow operator (`=>`). This eliminates the need for braces, thereby reducing the indentation and lines used. --- csharp/Antipattern.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/csharp/Antipattern.cs b/csharp/Antipattern.cs index ddc96b70..051195d0 100644 --- a/csharp/Antipattern.cs +++ b/csharp/Antipattern.cs @@ -13,15 +13,9 @@ class Person // Same as auto-property. public string Name { - get - { - return _name; - } + get => _name; - set - { - _name = value; - } + set => _name = value; } }