C# 0 The Complete Reference



Download 4,07 Mb.
Pdf ko'rish
bet764/1096
Sana23.01.2022
Hajmi4,07 Mb.
#402171
1   ...   760   761   762   763   764   765   766   767   ...   1096
Bog'liq
C-Sharp 3 The Complete Reference Herbert Schildt

GetZeroBal( )

 is not called because 



balance

 contains a value. 

As explained, when the left-hand expression of 

??

 contains a value, the right-hand expression 

is not evaluated.

Nullable Objects and the Relational and Logical Operators

Nullable objects can be used in relational expressions in just the same way as their 

corresponding non-nullable types. However, there is one additional rule that applies. 

When two nullable objects are compared using the 



<

,

>

,

<=

, or 


>=

 operators, the result 

is false if either of the objects is 

null

. For example, consider this sequence:

byte? lower = 16;

byte? upper = null;

// Here, lower is defined, but upper isn’t.

if(lower < upper) // false

Here, the result of the test for less than is false. However, somewhat counterintuitively, so is 

the inverse comparison:

if(lower > upper) // .. also false!

Thus, when one (or both) of the nullable objects used in a comparison is 



null

, the result of 

that comparison is always false. Thus, 

null

 does not participate in an ordering relationship.

You can test whether a nullable object contains 

null

, however, by using the 



==

 or 


!=

operators. For example, this is a valid test that will result in a true outcome:

if(upper == null) // ...

When a logical expression involves two 



bool?

 objects, the outcome of that expression 

will be one of three values: 

true

,

false

, or 

null

(undefined). Here are the entries that are 

added to the truth table for the 

&

 and 


|

 operators that apply to 



bool?

.

www.freepdf-books.com




Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   760   761   762   763   764   765   766   767   ...   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