C# 0 The Complete Reference


ch : char ch; ch = 'X'; You can output a  char



Download 4,07 Mb.
Pdf ko'rish
bet94/1096
Sana23.01.2022
Hajmi4,07 Mb.
#402171
1   ...   90   91   92   93   94   95   96   97   ...   1096
Bog'liq
C-Sharp 3 The Complete Reference Herbert Schildt

ch

:

char ch;



ch = 'X';

You can output a 



char

 value using a 



WriteLine( )

 statement. For example, this line outputs 

the value in 

ch

:

Console.WriteLine("This is ch: " + ch);



www.freepdf-books.com


42

 

P a r t   I :  



T h e   C #   L a n g u a g e

Although


char

 is defined by C# as an integer type, it cannot be freely mixed with integers 

in all cases. This is because there are no automatic type conversions from integer to 

char

.

For example, the following fragment is invalid:



char ch;

ch = 88; // error, won't work

The reason the preceding code will not work is that 10 is an integer value, and it won’t 

automatically convert to a 



char

. If you attempt to compile this code, you will see an error 

message. To make the assignment legal, you would need to employ a cast, which is 

described later in this chapter.




Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   90   91   92   93   94   95   96   97   ...   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