C# 0 The Complete Reference


PART I C h a p t e r   1 5



Download 4,07 Mb.
Pdf ko'rish
bet541/1096
Sana23.01.2022
Hajmi4,07 Mb.
#402171
1   ...   537   538   539   540   541   542   543   544   ...   1096
Bog'liq
C-Sharp 3 The Complete Reference Herbert Schildt


PART I

C h a p t e r   1 5 :  

D e l e g a t e s ,   E v e n t s ,   a n d   L a m b d a   E x p r e s s i o n s  

427


PART IPART I

    // Can't store this one -- full.

    evt.SomeEvent += zOb.Zhandler;

    Console.WriteLine();

    // Fire the events.

    evt.OnSomeEvent();

    Console.WriteLine();

    // Remove a handler.

    Console.WriteLine("Remove xOb.Xhandler.");

    evt.SomeEvent -= xOb.Xhandler;

    evt.OnSomeEvent();

    Console.WriteLine();

    // Try to remove it again.

    Console.WriteLine("Try to remove xOb.Xhandler again.");

    evt.SomeEvent -= xOb.Xhandler;

    evt.OnSomeEvent();

    Console.WriteLine();

    // Now, add Zhandler.

    Console.WriteLine("Add zOb.Zhandler.");

    evt.SomeEvent += zOb.Zhandler;

    evt.OnSomeEvent();

  }


}

The output from the program is shown here:

Adding events.

Event list full.

Event received by W object

Event received by X object

Event received by Y object

Remove xOb.Xhandler.

Event received by W object

Event received by Y object

Try to remove xOb.Xhandler again.

Event handler not found.

Event received by W object

Event received by Y object

Add zOb.Zhandler.

Event received by W object

Event received by Z object

Event received by Y object

www.freepdf-books.com



428

 

P a r t   I :  



T h e   C #   L a n g u a g e

Let’s examine this program closely. First, an event handler delegate called 




Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   537   538   539   540   541   542   543   544   ...   1096




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