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


Specifying an Application Error Code



Download 21,46 Mb.
Pdf ko'rish
bet178/1830
Sana28.09.2021
Hajmi21,46 Mb.
#188411
1   ...   174   175   176   177   178   179   180   181   ...   1830
Bog'liq
[book] [en] Pro C# 2008 and the NET 3.5 Platform Fourth Edition

Specifying an Application Error Code

While a vast majority of your Main() methods will return void as the return value, the ability to

return an int from Main() keeps C# consistent with other C-based languages. By convention,

returning the value 0 indicates the program has terminated successfully, while another value (such

as -1) represents an error condition (do be aware that the value 0 is automatically returned, even if

you construct a Main() method prototyped to return void).

On the Windows operating system, an application’s return value is stored within a system envi-

ronment variable named %ERRORLEVEL%. If you were to create an application that programmatically

launches another executable (a topic examined in Chapter 17), you can obtain the value of

%ERRORLEVEL% using the static System.Diagnostics.Process.ExitCode property.

Given that an application’s return value is passed to the system at the time the application ter-

minates, it is obviously not possible for an application to obtain and display its final error code

while running. However, to illustrate how to view this error level upon program termination, begin

by updating the Main() method as follows:




Download 21,46 Mb.

Do'stlaringiz bilan baham:
1   ...   174   175   176   177   178   179   180   181   ...   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