C# 0 The Complete Reference


ISeries  interface must be passed to  ByTwos



Download 4,07 Mb.
Pdf ko'rish
bet663/1096
Sana23.01.2022
Hajmi4,07 Mb.
#402171
1   ...   659   660   661   662   663   664   665   666   ...   1096
Bog'liq
C-Sharp 3 The Complete Reference Herbert Schildt

ISeries

 interface must be passed to 



ByTwos

. Otherwise, 

there is no way for the interface to receive the type argument.

Next, the current value of the series, 



val

, and the starting value, 



start

, are declared to be 

objects of the generic type 

T

. Then, a delegate called 



IncByTwo

 is declared. This delegate 

defines the form of a method that will be used to increase an object of type 

T

 by two. In order 

for

ByTwos

 to work with any type of data, there must be some way to define what an increase 

by two means for each type of data. This is achieved by passing to the 

ByTwos

 constructor a 

reference to a method that performs an increase by two. This reference is stored in 

incr

. When 


the next element in the series is needed, that method is called through the 

incr

 delegate to 

obtain the next value in the series.

Notice the class 



ThreeD

. It encapsulates three-dimensional (X,Z,Y) coordinates. It is 

used to demonstrate 

ByTwos

 on a class type.

In

GenIntfDemo

, three increment methods are declared; one for 




Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   659   660   661   662   663   664   665   666   ...   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