File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,16 +41,17 @@ You can check if it works properly on your motherboard. For many manufacturers,
4141``` c#
4242public 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 (" \t Subhardware: {0}" , subhardware .Name );
8081
8182 foreach (ISensor sensor in subhardware .Sensors )
82- {
8383 Console .WriteLine (" \t\t Sensor: {0}, value: {1}" , sensor .Name , sensor .Value );
84- }
8584 }
8685
8786 foreach (ISensor sensor in hardware .Sensors )
88- {
8987 Console .WriteLine (" \t Sensor: {0}, value: {1}" , sensor .Name , sensor .Value );
90- }
9188 }
9289
9390 computer .Close ();
You can’t perform that action at this time.
0 commit comments