This print for content only-size & color not accurate 7" X 9-1/4" / casebound / malloy



Download 21,46 Mb.
Pdf ko'rish
bet301/1830
Sana28.09.2021
Hajmi21,46 Mb.
#188411
1   ...   297   298   299   300   301   302   303   304   ...   1830
Bog'liq
[book] [en] Pro C# 2008 and the NET 3.5 Platform Fourth Edition

// Compiler errors!

// Value types cannot be set to null!

bool myBool = null;

int myInt = null;

C H A P T E R   4  



C O R E   C #   P R O G R A M M I N G   C O N S T R U C T S, PA RT   I I



136

8849CH04.qxd  10/1/07  10:31 AM  Page 136




// OK! Strings are reference types.

string myString = null;

}

Since the release of .NET 2.0, it has been possible to create nullable data types. Simply put, a



nullable type can represent all the values of its underlying type, plus the value null. Thus, if we

declare a nullable System.Boolean, it could be assigned a value from the set {true, false, null}.

This can be extremely helpful when working with relational databases, given that it is quite com-

mon to encounter undefined columns in database tables. Without the concept of a nullable data

type, there is no convenient manner in C# to represent a numerical data point with no value.

To define a nullable variable type, the question mark symbol (?) is suffixed to the underlying

data type. Do note that this syntax is only legal when applied to value types. If you attempt to create

a nullable reference type (including strings), you are issued a compile-time error. Like a nonnul-

lable variable, local nullable variables must be assigned an initial value:

static void LocalNullableVariables()

{


Download 21,46 Mb.

Do'stlaringiz bilan baham:
1   ...   297   298   299   300   301   302   303   304   ...   1830




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