Skip to content

Commit a17d240

Browse files
authored
Refactor VisitComputer and formatting in README.md
1 parent 824e400 commit a17d240

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

README.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,17 @@ You can check if it works properly on your motherboard. For many manufacturers,
4141
```c#
4242
public class UpdateVisitor : IVisitor
4343
{
44-
public void VisitComputer(IComputer computer)
45-
{
46-
computer.Traverse(this);
47-
}
44+
public void VisitComputer(IComputer computer) => computer.Traverse(this);
45+
4846
public void VisitHardware(IHardware hardware)
4947
{
5048
hardware.Update();
51-
foreach (IHardware subHardware in hardware.SubHardware) subHardware.Accept(this);
49+
foreach (IHardware subHardware in hardware.SubHardware)
50+
subHardware.Accept(this);
5251
}
52+
5353
public void VisitSensor(ISensor sensor) { }
54+
5455
public void VisitParameter(IParameter parameter) { }
5556
}
5657

@@ -79,15 +80,11 @@ public void Monitor()
7980
Console.WriteLine("\tSubhardware: {0}", subhardware.Name);
8081

8182
foreach (ISensor sensor in subhardware.Sensors)
82-
{
8383
Console.WriteLine("\t\tSensor: {0}, value: {1}", sensor.Name, sensor.Value);
84-
}
8584
}
8685

8786
foreach (ISensor sensor in hardware.Sensors)
88-
{
8987
Console.WriteLine("\tSensor: {0}, value: {1}", sensor.Name, sensor.Value);
90-
}
9188
}
9289

9390
computer.Close();

0 commit comments

Comments
 (0)