Skip to content

Commit

Permalink
fffoofoof
Browse files Browse the repository at this point in the history
  • Loading branch information
sharpchen committed Oct 23, 2024
1 parent 8ce0ffe commit 727251c
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,21 @@
## Motivation

- To be informed when status changed
- To be informed when certain things happened.
- To be informed when certain things happened.
- Listen to events and get notified when they occurs

.NET has following builtin types to perform observer pattern.

- `INotifyPropertyChanged`
- `INotifyPropertyChanging`
- `IObservable<T>`
- `IObserver<T>`
- `ObervableCollection<T>`
- `BindingList<T>`

> Observer is the object to be informed when event occurs
> Observable is the object generating the event.
> [!NOTE]
> Observer is the object to be informed when event occurs, informed by passing event args.
> Observable is the object passes the event args when performing something.
## By Event

Expand Down Expand Up @@ -166,7 +169,7 @@ classDiagram
PlayerEventArgs <|-- OnAttackEventArgs
```

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

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

0 comments on commit 727251c

Please sign in to comment.