C# 0 The Complete Reference


TextReader  that underlies  Console.In



Download 4,07 Mb.
Pdf ko'rish
bet478/1096
Sana23.01.2022
Hajmi4,07 Mb.
#402171
1   ...   474   475   476   477   478   479   480   481   ...   1096
Bog'liq
C-Sharp 3 The Complete Reference Herbert Schildt

TextReader

 that underlies 



Console.In

, you 


will invoke those methods as shown in this example.

Using ReadKey( )

Beginning with version 2.0, the .NET Framework has included a method in 



Console

 that 


enables you to read individual keystrokes directly from the keyboard in a non-line-buffered 

manner. This method is called 



ReadKey( )

. When it is called, it waits until a key is pressed. 

When a key is pressed, 

ReadKey( )

 returns the keystroke immediately. The user does not need 

to press 

ENTER


. Thus, 

ReadKey( )

 allows keystrokes to be read and processed in real time.



ReadKey( )

 has these two forms.

static ConsoleKeyInfo ReadKey( )

static ConsoleKeyInfo ReadKey(bool 



noDisplay

)

The first form waits for a key to be pressed. When that occurs, it returns the key and also 



displays the key on the screen. The second form also waits for and returns a keypress. 

However, if 



noDisplay

 is true, then the key is not displayed. If 



noDisplay

 is false, the key 

is displayed.

ReadKey( )

 returns information about the keypress in an object of type 



ConsoleKeyInfo

,

which is a structure. It contains the following read-only properties.



char KeyChar

ConsoleKey Key

ConsoleModifi ers Modifi ers

www.freepdf-books.com




370

 

P a r t   I :  



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


Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   474   475   476   477   478   479   480   481   ...   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