This print for content only-size & color not accurate 7" X 9-1/4" / casebound / malloy



Download 21,46 Mb.
Pdf ko'rish
bet522/1830
Sana28.09.2021
Hajmi21,46 Mb.
#188411
1   ...   518   519   520   521   522   523   524   525   ...   1830
Bog'liq
[book] [en] Pro C# 2008 and the NET 3.5 Platform Fourth Edition



Note

It is illegal to override 

Finalize()

on structure types. This makes perfect sense given that structures are

value types, which are never allocated on the heap to begin with, and therefore are not garbage collected!

Of course, a call to Finalize() will (eventually) occur during a “natural” garbage collection

or when you programmatically force a collection via GC.Collect(). In addition, a type’s finalizer

method will automatically be called when the application domain hosting your application is

unloaded from memory. Based on your current background in .NET, you may know that application

domains (or simply AppDomains) are used to host an executable assembly and any necessary

external code libraries. If you are not familiar with this .NET concept, you will be by the time you’ve

finished Chapter 17. The short answer is that when your AppDomain is unloaded from memory, the

CLR automatically invokes finalizers for every finalizable object created during its lifetime.

Now, despite what your developer instincts may tell you, a 



vast majority of your C# classes will

not require any explicit cleanup logic and will not need a custom finalizer. The reason is simple: if

your types are simply making use of other managed objects, everything will eventually be garbage

collected. The only time you would need to design a class that can clean up after itself is when you

are making use of 

unmanaged resources (such as raw OS file handles, raw unmanaged database

connections, chunks of unmanaged memory, or other unmanaged resources). Under the .NET plat-

form, unmanaged resources are obtained by directly calling into the API of the operating system

using Platform Invocation Services (PInvoke) or due to some very elaborate COM interoperability

scenarios. Given this, consider the next rule of garbage collection:


Download 21,46 Mb.

Do'stlaringiz bilan baham:
1   ...   518   519   520   521   522   523   524   525   ...   1830




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