Skip to content

Commit 5f53af5

Browse files
Update Updates.md #190
delegates and events
1 parent f605227 commit 5f53af5

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Updates.md

+18
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,24 @@ Page 190, the event name should be `NewCarCreated` instead of `NewCarInfo`:
4444

4545
Thanks to [@DanielNikoofar](https://github.com/DanielNikoofar) for reporting this issue!
4646

47+
Page 191, the method should be `CreateANewCar` instead of `NewCar()`, and the event `NewCarCreated` instead of `NewCarInfo` (also see page 190).
48+
49+
```csharp
50+
CarDealer dealer = new();
51+
Consumer sebastian = new("Sebastian");
52+
dealer.NewCarCreated += sebastian.NewCarIsHere;
53+
dealer.CreateANewCar("Williams");
54+
Consumer max = new("Max");
55+
dealer.NewCarCreated += max.NewCarIsHere;
56+
dealer.CreateANewCar("Aston Martin");
57+
dealer.NewCarCreated -= sebastian.NewCarIsHere;
58+
dealer.CreateANewCar("Ferrari");
59+
```
60+
61+
[See source code - EventsSample/Program.cs](https://github.com/ProfessionalCSharp/ProfessionalCSharp2021/blob/main/1_CS/Delegates/EventsSample/Program.cs)
62+
63+
Thanks to [@zpfdev](https://github.com/zpfdev)) for reporting this issue!
64+
4765
## Chapter 11, Tasks and Asynchronous Programming
4866

4967
Page 296 shows this source code:

0 commit comments

Comments
 (0)