Skip to content

Commit 727251c

Browse files
committed
fffoofoof
1 parent 8ce0ffe commit 727251c

File tree

1 file changed

+7
-4
lines changed
  • docs/document/Csharp Design Patterns/docs/Behavioural

1 file changed

+7
-4
lines changed

docs/document/Csharp Design Patterns/docs/Behavioural/Observer.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,21 @@
33
## Motivation
44

55
- To be informed when status changed
6-
- To be informed when certain things happened.
6+
- To be informed when certain things happened.
77
- Listen to events and get notified when they occurs
88

9+
.NET has following builtin types to perform observer pattern.
10+
911
- `INotifyPropertyChanged`
1012
- `INotifyPropertyChanging`
1113
- `IObservable<T>`
1214
- `IObserver<T>`
1315
- `ObervableCollection<T>`
1416
- `BindingList<T>`
1517

16-
> Observer is the object to be informed when event occurs
17-
> Observable is the object generating the event.
18+
> [!NOTE]
19+
> Observer is the object to be informed when event occurs, informed by passing event args.
20+
> Observable is the object passes the event args when performing something.
1821
1922
## By Event
2023

@@ -166,7 +169,7 @@ classDiagram
166169
PlayerEventArgs <|-- OnAttackEventArgs
167170
```
168171

169-
**Observable and Observer do not know each other, the mediator is certain `EventArgs`. Observer handles notifications by different kinds of `EvntArgs`.**
172+
**Observable and Observer do not know each other, the mediator is certain `EventArgs`. Observer handles notifications by different kinds of `EventArgs`.**
170173

171174
- Observable: adds Observers
172175
- Subscription: as a `IDisposable` pair of Observer and Observable, will be stored on a collection inside Observable.

0 commit comments

Comments
 (0)