Gc SuppressFinalize yog dab tsi?
Gc SuppressFinalize yog dab tsi?

Video: Gc SuppressFinalize yog dab tsi?

Video: Gc SuppressFinalize yog dab tsi?
Video: Distributed .NET Core (DShop) - Episode 14 [Consumer-driven contract testing with Pact] 2024, Kaum ib hlis
Anonim

SuppressFinalize yog: txhawm rau tiv thaiv qhov kawg ntawm kev tso tawm cov peev txheej tsis tau tswj hwm uas twb tau tso tawm los ntawm IDisposable. Tshem tawm kev siv. Source: MSDN. Thaum koj muab cov khoom pov tseg, koj yuav tsum hu xov tooj tiag GC.

Kuj paub, Gc sau hauv C# yog dab tsi?

GC . Sau () - siv rau sau cov khoom tam sim no nyob rau tiam 0, 1, 2. GC . Sau (0) - siv rau sau cov khoom tam sim no nyob rau tiam 0. GC . Sau (1) - siv rau sau Cov khoom tam sim no nyob rau tiam 0 thiab 1. Koj tseem tuaj yeem txiav txim siab tias lub cim xeeb tau tso tawm ntau npaum li cas los ntawm kev hu mus rau GC.

Qhov thib ob, kev siv Finalize txoj kev hauv C# yog dab tsi? Cov txoj kev ua tiav () raug hu los ntawm tus neeg khaws khib nyiab. Txoj kev pov() yog siv kom pub dawb cov peev txheej uas tsis tau tswj hwm thaum twg nws tau thov. Txoj kev ua tiav () yog siv kom pub dawb tsis muaj kev tswj hwm ua ntej qhov khoom puas tsuaj. Cov txoj kev muab pov tseg () yuav tsum tau ua thaum twg muaj qhov ze () txoj kev.

Ib yam li ntawd, koj tuaj yeem nug, IDisposable hauv C# yog dab tsi?

IDisposable yog ib qho kev sib txuas uas muaj ib txoj hauv kev, Dispose(), tso tawm cov peev txheej tsis muaj kev tswj hwm, xws li cov ntaub ntawv, cov kwj deg, cov ntaub ntawv sib txuas thiab lwm yam.

Dab tsi yog khib nyiab hauv asp net?

Cov khib nyiab , nyob rau hauv cov ntsiab lus ntawm. NET , yog tus txheej txheem uas hom lus siv sijhawm (CLR) ntawm. NET lub moj khaum tswj lub cim xeeb los ntawm kev faib thiab tso lub cim xeeb cia li. Chav kawm GC ntawm. NET chav tsev qiv ntawv tswj cov khib nyiab.

Pom zoo: