Skip to Content
C# 7.0 – kurz & gut, 5th Edition
book

C# 7.0 – kurz & gut, 5th Edition

by Joseph Albahari, Ben Albahari
April 2018
Intermediate to advanced content levelIntermediate to advanced
238 pages
4h 32m
German
dpunkt
Content preview from C# 7.0 – kurz & gut, 5th Edition

Events

Wenn man Delegates nutzt, gibt es zwei Rollen, die sehr häufig im Spiel sind: Broadcaster und Subscriber. Der Broadcaster ist ein Typ, der ein Delegate-Feld enthält. Er entscheidet, wann ein Broadcast verschickt werden soll, indem er das Delegate aufruft. Die Subscriber sind die Zielmethodenempfänger. Ein Subscriber entscheidet, von wann bis wann er zuhört, indem er += und -= für das Delegate des Broadcasters verwendet. Ein Subscriber weiß nichts von anderen Subscribern, kommt mit ihnen aber auch nicht in Konflikt.

Events sind ein Sprachfeature, das dieses Muster formalisiert. Ein event ist ein Konstrukt, das nur genau die Untermenge an Delegate-Features bereitstellt, die für das Broadcaster/Subscriber-Modell notwendig sind. Der Hauptzweck ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C# 8.0 – kurz & gut, 6th Edition

C# 8.0 – kurz & gut, 6th Edition

Joseph Albahari, Ben Albahari
Reguläre Ausdrücke Kochbuch

Reguläre Ausdrücke Kochbuch

Jan Goyvaerts, Steven Levithan

Publisher Resources

ISBN: 9781492067740