C# 0 The Complete Reference


How Generic Types Are Instantiated



Download 4,07 Mb.
Pdf ko'rish
bet675/1096
Sana23.01.2022
Hajmi4,07 Mb.
#402171
1   ...   671   672   673   674   675   676   677   678   ...   1096
Bog'liq
C-Sharp 3 The Complete Reference Herbert Schildt

How Generic Types Are Instantiated

One question that is often raised when working with generics is whether the use of a generic 

class leads to code-bloat at runtime. The simple answer is no. The reason is that C# implements 

generics in a highly efficient manner that creates new constructed types only when they are 

needed. Here is how the process works.

When a generic class is compiled into MSIL, it retains all of its type parameters in their 

generic form. At runtime, when a specific instance of the class is required, the JIT compiler 

constructs a specific, executable code version of the class in which the type parameters are 

replaced by the type arguments. Each instance of the class that uses the same type arguments 

will use the same executable code version.

For example, given some generic class called 


Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   671   672   673   674   675   676   677   678   ...   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