C# 0 The Complete Reference


CountDown  is declared within the  Counter



Download 4,07 Mb.
Pdf ko'rish
bet555/1096
Sana23.01.2022
Hajmi4,07 Mb.
#402171
1   ...   551   552   553   554   555   556   557   558   ...   1096
Bog'liq
C-Sharp 3 The Complete Reference Herbert Schildt

CountDown

 is declared within the 



Counter

 namespace, when an object is created, 



CountDown

 must be qualified with 



Counter

, as shown here:

Counter.CountDown cd1 = new Counter.CountDown(10);

This rule can be generalized. Whenever you use a member of a namespace, you must 

qualify it with the namespace name. If you don’t, the member of the namespace won’t be 

found by the compiler.

Second, once an object of type 

Counter

 has been created, it is not necessary to further 

qualify it or any of its members with the namespace. Thus, 

cd1.Count( )

 can be called 

directly without namespace qualification, as this line shows:

i = cd1.Count();

Third, for the sake of illustration, this example uses two separate files. One holds the 

Counter

 namespace and the other holds the 



NSDemo

 program. However, both could have 

been contained in the same file. Furthermore, a single file can contain two or more named 

namespaces, with each namespace defining its own declarative region. When a named 

www.freepdf-books.com



440

 

P a r t   I :  



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

namespace ends, the outer namespace resumes, which in the case of the 



Counter

 is the 


global namespace. For clarity, subsequent examples will show all namespaces required by a 

program within the same file, but remember that separate files would be equally valid (and 

more commonly used in production code).


Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   551   552   553   554   555   556   557   558   ...   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