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


[mscorlib]System.Delegate::Combine(



Download 21,46 Mb.
Pdf ko'rish
bet724/1830
Sana28.09.2021
Hajmi21,46 Mb.
#188411
1   ...   720   721   722   723   724   725   726   727   ...   1830
Bog'liq
[book] [en] Pro C# 2008 and the NET 3.5 Platform Fourth Edition

[mscorlib]System.Delegate::Combine(

class [mscorlib]System.Delegate, class [mscorlib]System.Delegate)

castclass CarEvents.Car/CarEventHandler

stfld class CarEvents.Car/CarEventHandler CarEvents.Car::AboutToBlow

ret


}

As you would expect, remove_AboutToBlow() will indirectly call Delegate.Remove() and is more

or less identical to the previous RemoveAboutToBlow() helper method:

.method public hidebysig specialname instance void



remove_AboutToBlow(class CarEvents.Car/CarEventHandler 'value')

cil managed synchronized

{

.maxstack  8



ldarg.0

ldarg.0


ldfld class CarEvents.Car/CarEventHandler CarEvents.Car::AboutToBlow

ldarg.1


call class [mscorlib]System.Delegate

[mscorlib]System.Delegate::Remove(

class [mscorlib]System.Delegate, class [mscorlib]System.Delegate)

castclass CarEvents.Car/CarEventHandler

stfld class CarEvents.Car/CarEventHandler CarEvents.Car::AboutToBlow

ret


}

Finally, the CIL code representing the event itself makes use of the .addon and .removeon direc-

tives to map the names of the correct add_XXX() and remove_XXX() methods to invoke:

.event CarEvents.Car/EngineHandler AboutToBlow

{

.addon void CarEvents.Car::add_AboutToBlow

(class CarEvents.Car/CarEngineHandler)



.removeon void CarEvents.Car::remove_AboutToBlow

(class CarEvents.Car/CarEngineHandler)

}

Now that you understand how to build a class that can send C# events (and are aware that



events are little more than a typing time-saver), the next big question is how to “listen to” the

incoming events on the caller’s side.




Download 21,46 Mb.

Do'stlaringiz bilan baham:
1   ...   720   721   722   723   724   725   726   727   ...   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