Skip to content

Commit f344c7a

Browse files
committed
Code review for style
Fix any style issues with the current code.
1 parent 29c3905 commit f344c7a

File tree

3 files changed

+6
-21
lines changed

3 files changed

+6
-21
lines changed

docs/csharp/programming-guide/classes-and-structs/snippets/constructors/Program.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@ public class Adult : Person
2525
public Adult(string lastName, string firstName) : base(lastName, firstName)
2626
{ }
2727

28-
static Adult()
29-
{
30-
minimumAge = 18;
31-
}
28+
static Adult() => minimumAge = 18;
3229

3330
// Remaining implementation of Adult class.
3431
}

docs/csharp/programming-guide/classes-and-structs/snippets/constructors/constructors.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework>
5+
<TargetFramework>net9.0</TargetFramework>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
</PropertyGroup>

docs/csharp/programming-guide/classes-and-structs/snippets/using-constructors/Program.cs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,9 @@ public class Taxi
33
{
44
private string taxiTag;
55

6-
public Taxi(string tag)
7-
{
8-
taxiTag = tag;
9-
}
6+
public Taxi(string tag) => taxiTag = tag;
107

11-
public override string ToString()
12-
{
13-
return $"Taxi: {taxiTag}";;
14-
}
8+
public override string ToString() => $"Taxi: {taxiTag}";
159
}
1610

1711
class TestTaxi
@@ -42,16 +36,10 @@ public class Employee
4236
public Employee() { }
4337

4438
//<Snippet9>
45-
public Employee(int annualSalary)
46-
{
47-
Salary = annualSalary;
48-
}
39+
public Employee(int annualSalary) => Salary = annualSalary;
4940
//</Snippet9>
5041

51-
public Employee(int weeklySalary, int numberOfWeeks)
52-
{
53-
Salary = weeklySalary * numberOfWeeks;
54-
}
42+
public Employee(int weeklySalary, int numberOfWeeks) => Salary = weeklySalary * numberOfWeeks;
5543
}
5644
//</Snippet3>
5745

0 commit comments

Comments
 (0)