This print for content only-size & color not accurate 7" X 9-1/4" / casebound / malloy


Understanding Callback Interfaces



Download 21,46 Mb.
Pdf ko'rish
bet605/1830
Sana28.09.2021
Hajmi21,46 Mb.
#188411
1   ...   601   602   603   604   605   606   607   608   ...   1830
Bog'liq
[book] [en] Pro C# 2008 and the NET 3.5 Platform Fourth Edition

Understanding Callback Interfaces

Beyond using interfaces to establish polymorphism across diverse class hierarchies, namespaces,

and assemblies, interfaces may also be used as a 

callback mechanism. This technique enables

objects to engage in a two-way conversation using a common set of members.





Note

The .NET platform provides a formal fabric used to build events (which is quite different from the tech-

nique that will be shown here). As you will see in Chapter 11, delegates, events, and lambdas are the standard way

to enable objects to chit-chat back and forth.

To illustrate the use of callback interfaces, let’s update the now familiar Car type in such a way

that it is able to inform the caller when it is about to explode (the current speed is 10 miles below

the maximum speed) and has exploded (the current speed is at or above the maximum speed).

Begin by creating a new Console Application named CallbackInterface. The ability to send and

receive these events will be facilitated with a new custom interface named IEngineNotification:


Download 21,46 Mb.

Do'stlaringiz bilan baham:
1   ...   601   602   603   604   605   606   607   608   ...   1830




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish