C# 0 The Complete Reference


obj  (which is of type  T



Download 4,07 Mb.
Pdf ko'rish
bet649/1096
Sana23.01.2022
Hajmi4,07 Mb.
#402171
1   ...   645   646   647   648   649   650   651   652   ...   1096
Bog'liq
C-Sharp 3 The Complete Reference Herbert Schildt

obj

 (which is of type 



T

) is assigned the value 



null

. This assignment is valid only for 

reference types. As a general rule, you cannot assign 

null

 to a value type. (The exception to 

this rule is the 

nullable type,

 which is a special structure type that encapsulates a value type 

and allows the value 

null

. See Chapter 20 for details.) Therefore, without the constraint, the 

www.freepdf-books.com



PART I

C h a p t e r   1 8 :  

G e n e r i c s  

519


PART IPART I

assignment would not have been valid and the compile would have failed. This is one case 

in which the difference between value types and reference types might be important to a 

generic routine.

The value type constraint is the complement of the reference type constraint. It simply 

ensures that any type argument is a value type, including a 




Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   645   646   647   648   649   650   651   652   ...   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