C# 0 The Complete Reference


out  parameters. Friend Assemblies



Download 4,07 Mb.
Pdf ko'rish
bet768/1096
Sana23.01.2022
Hajmi4,07 Mb.
#402171
1   ...   764   765   766   767   768   769   770   771   ...   1096
Bog'liq
C-Sharp 3 The Complete Reference Herbert Schildt

out

 parameters.



Friend Assemblies

It is possible to make one assembly the 



friend

 of another. A friend has access to the private 

members of the assembly of which it is a friend. This feature makes it possible to share 

members between selected assemblies without making those members public.

To declare a friend assembly, you must specify the friend assembly’s name and its 

public key token in an 



InternalsVisibleTo

 attribute.



Miscellaneous Keywords

To conclude Part I, the few remaining keywords defined by C# that have not been described 

elsewhere are briefly discussed.

lock

The


lock

 keyword is used when creating multithreaded programs. It is examined in detail 

in Chapter 23, where multithreaded programming is discussed. A brief description is given 

here for the sake of completeness.

www.freepdf-books.com



606

 

P a r t   I :  



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

In C#, a program can contain more than one 



thread of execution.

 When this is the case, the 

program is said to be 

multithreaded,

 and pieces of the program are executed concurrently. Thus, 

pieces of the program execute independently and simultaneously. This raises the prospect 

of a special type of problem: What if two threads try to use a resource that can be used by 

only one thread at a time? To solve this problem, you can create a 

critical code section

 that 


will be executed by one and only one thread at a time. This is accomplished by 

lock

. Its 


general form is shown here:

lock(


obj

) {


   // 

critical section

}

Here, 



obj

 is the object on which the lock is synchronized. If one thread has already entered 

the critical section, then a second thread will wait until the first thread exits the critical 

section. When the first thread leaves the critical section, the lock is released and the second 

thread can be granted the lock, at which point the second thread can execute the critical 

section.



Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   764   765   766   767   768   769   770   771   ...   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