C# 0 The Complete Reference


s1  is of type  double



Download 4,07 Mb.
Pdf ko'rish
bet106/1096
Sana23.01.2022
Hajmi4,07 Mb.
#402171
1   ...   102   103   104   105   106   107   108   109   ...   1096
Bog'liq
C-Sharp 3 The Complete Reference Herbert Schildt

s1

 is of type 



double

. Thus, it cannot be assigned a 



decimal

 value. The only difference between an implicitly typed variable and a “normal” 

explicitly typed variable is how the type is determined. Once that type has been determined, 

the variable has a type, and this type is fixed throughout the lifetime of the variable. Thus, 

the type of 

s1

 cannot be changed during execution of the program.

Implicitly typed variables were not added to C# to replace “normal” variable declarations. 

Instead, implicitly typed variables are designed to handle some special-case situations, the 

most important of which relate to Language-Integrated Query (LINQ), which is described 

in Chapter 19. Therefore, for most variable declarations, you should continue to use explicitly 

typed variables because they make your code easier to read and easier to understand.

One last point: Only one implicitly typed variable can be declared at any one time. 

Therefore, the following declaration,

var s1 = 4.0, s2 = 5.0; // Error!

is wrong and won’t compile because it attempts to declare both 


Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   102   103   104   105   106   107   108   109   ...   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