C# 0 The Complete Reference



Download 4,07 Mb.
Pdf ko'rish
bet551/1096
Sana23.01.2022
Hajmi4,07 Mb.
#402171
1   ...   547   548   549   550   551   552   553   554   ...   1096
Bog'liq
C-Sharp 3 The Complete Reference Herbert Schildt

kevt.OnKeyPress( )

 when a key is pressed. This causes 

the registered event handlers to be notified. When the loop ends, the number of keypresses 

is displayed. Although quite simple, this example illustrates the essence of event handling. 

The same basic approach will be used for other event handling situations. Of course, in 

some cases, anonymous event handlers will not be appropriate and named methods will 

need to be employed.

www.freepdf-books.com




This page intentionally left blank 

www.freepdf-books.com




16

Namespaces, the 

Preprocessor, and Assemblies

T

his chapter discusses three C# features that give you greater control over the 



organization and accessibility of a program. These are namespaces, the preprocessor, 

and assemblies.



Namespaces

The namespace was mentioned briefly in Chapter 2 because it is a concept fundamental to 

C#. In fact, every C# program makes use of a namespace in one way or another. We didn’t 

need to examine namespaces in detail before now because C# automatically provides a 

default, global namespace for your program. Thus, the programs in earlier chapters simply 

used the global namespace. In the real world, however, many programs will need to create 

their own namespaces or interact with other namespaces. Here, they are examined in detail.

A

namespace

 defines a declarative region that provides a way to keep one set of names 

separate from another. In essence, names declared in one namespace will not conflict with 

the same names declared in another. The namespace used by the .NET Framework library 

(which is the C# library) is 



System

. This is why you have included

using System;

near the top of every program. As explained in Chapter 14, the I/O classes are defined 

within a namespace subordinate to 


Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   547   548   549   550   551   552   553   554   ...   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