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


// Now make use of some format tags



Download 21,46 Mb.
Pdf ko'rish
bet191/1830
Sana28.09.2021
Hajmi21,46 Mb.
#188411
1   ...   187   188   189   190   191   192   193   194   ...   1830
Bog'liq
[book] [en] Pro C# 2008 and the NET 3.5 Platform Fourth Edition

// Now make use of some format tags.

static void FormatNumericalData()

{

Console.WriteLine("The value 99999 in various formats:");



Console.WriteLine("c format: {0:c}", 99999);

Console.WriteLine("d9 format: {0:d9}", 99999);

Console.WriteLine("f3 format: {0:f3}", 99999);

Console.WriteLine("n format: {0:n}", 99999);

C H A P T E R   3  

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



78

8849CH03.qxd  9/24/07  11:07 AM  Page 78




// Notice that upper- or lowercasing for hex

// determines if letters are upper- or lowercase.

Console.WriteLine("E format: {0:E}", 99999);

Console.WriteLine("e format: {0:e}", 99999);

Console.WriteLine("X format: {0:X}", 99999);

Console.WriteLine("x format: {0:x}", 99999);

}

Figure 3-5 shows the output for our current application.



Figure 3-5.

Basic console I/O (with .NET string formatting)

Beyond controlling how numerical data is formatted, the .NET platform provides additional

tokens that may appear in a string literal that controls spacing and positioning of content.

Furthermore, the tokens applied to numerical data can be applied to other data types (such as

enumerations or the DateTime type) to control data formatting. Also be aware that it is possible

to build a custom class (or structure) that defines a custom formatting scheme through the imple-

mentation of the ICustomFormatter interface.

You’ll see additional formatting examples where required throughout this text; however, if you

are interested in digging into .NET string formatting further, look up the topic “Formatting Types”

within the .NET Framework 3.5 SDK documentation.




Download 21,46 Mb.

Do'stlaringiz bilan baham:
1   ...   187   188   189   190   191   192   193   194   ...   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