C# 0 The Complete Reference


null . For example, using  count



Download 4,07 Mb.
Pdf ko'rish
bet759/1096
Sana23.01.2022
Hajmi4,07 Mb.
#402171
1   ...   755   756   757   758   759   760   761   762   ...   1096
Bog'liq
C-Sharp 3 The Complete Reference Herbert Schildt

null

. For example, using 



count

 declared by the 

preceding statement, the following determines if it has a value:

if(count != null) // has a value

If

count

 is not 


null

, then it contains a value.

The second way to determine if a nullable type contains a value is to use the 

HasValue

read-only property defined by 



Nullable

. It is shown here:

bool HasValue

HasValue

 will return true if the instance on which it is called contains a value. It will return 

false otherwise. Using the 

HasValue

 property, here is the second way to determine if the 

nullable object 

count

 has a value:

if(count.HasValue) // has a value

Assuming that a nullable object contains a value, you can obtain its value by using the 



Value

 read-only property defined by 



Nullable

, which is shown here:

T Value

It returns the value of the nullable instance on which it is called. If you try to obtain a value 

from a variable that is 


Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   755   756   757   758   759   760   761   762   ...   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