Cov txheej txheem:

Dab tsi yog qhov peev txheej tsis tswj hwm C#?
Dab tsi yog qhov peev txheej tsis tswj hwm C#?

Video: Dab tsi yog qhov peev txheej tsis tswj hwm C#?

Video: Dab tsi yog qhov peev txheej tsis tswj hwm C#?
Video: Saib Mis paub Poj niam (hluas nkauj) tus yam ntxwv lub siab 2024, Kaum ib hlis
Anonim

Unmanaged peev txheej yog cov uas khiav tawm sab nraud. NET runtime (CLR)(aka non-. NET code.) Piv txwv li, hu rau DLL hauv Win32 API, lossis hu rau. dll sau rau hauv C ++.

Dhau li ntawm qhov no, dab tsi yog cov peev txheej tsis tswj hwm hauv C #?

Cov khoom tsis raug tswj hwm yog qhwv ib ncig ntawm lub operating system peev txheej xws li cov ntaub ntawv ntws, kev sib txuas ntawm cov ntaub ntawv, cov xwm txheej ntsig txog network, ua haujlwm rau cov chav kawm sib txawv, kev sau npe, tus taw tes, thiab lwm yam. Unmanaged peev txheej tuaj yeem ntxuav tau siv 'Dispose' txoj kev thiab 'siv' nqe lus.

Tom qab ntawd, lo lus nug yog, C# tswj hwm lossis tsis tswj hwm? Daim ntawv thov raug sau ua hom lus xws li Java, C# , VB. Net, thiab lwm yam yog ib txwm tsom rau cov kev pabcuam hauv ib puag ncig los tswj kev ua tiav thiab cov lej sau ua hom lus no hu ua tswj code.

Kuj Paub, koj ua li cas pov tseg cov peev txheej tsis tau tswj hwm hauv C#?

Feem ntau cov peev txheej uas tsis tau tswj hwm yuav raug tso tawm hauv ob qhov chaw:

  1. Txoj kev Dispose() method. Qhov no yuav tsum yog txoj hauv kev uas koj pov tseg cov peev txheej uas tsis tau tswj hwm.
  2. Qhov Kawg. Qhov no yog qhov kawg-resort mechanism. Yog hais tias ib chav kawm muaj ib tug finalizer nws yuav raug hu los ntawm Cov Khib Nyiab Collector thaum nws ntxuav cov khoom tuag.

Dab tsi yog tswj code thiab unmanaged code hauv C# nrog piv txwv?

NET Framework yog tswj code . Tswj code siv CLR uas nyob rau hauv lem saib tom qab koj daim ntawv thov los ntawm kev tswj lub cim xeeb, tuav kev ruaj ntseg, cia tus ntoo khaub lig - debugging lus, thiab hais txog. Cov code , uas yog tsim sab nraud. NET, Framework yog lub npe hu ua tsis tswj code.

Pom zoo: