????

??????????????????????????C#?е?????

?????????????????????????????????????????????????????в??????????κ????η????????????á??????????????????????????????????‘~’???????

???????C#??????е????CLR??????????μ??????????---?????????????Automatic memory management????????????????????“??????????” ????????????????????????????Щ?????????????????????????????????C#?з??й??????????

????????????????????"??????????"???????????????????????Щ???????????

????1. ??????????????????????????????"??????????"?????????????????????????????????????????棬???????????????(Stack)??;

????2. ????????????????????????????????????(Heap)?У?????????????????洢????????????????"?"????????????("?"?????????????????????????????????????)??????????????"??????????"????????????????;

???????????Щ????£???????????й??????????????д???????????????????????????????????й????????????????д???????й?????????η????????????м??ɡ???????????????????????????????й??????????????????????????????????????????????????????????"??????????"??????й????????????????????????????β?????????й???????????????????????????????????δ?????????????δ????????????????????????

????public class ResourceHolder { … ~ResourceHolder() { ??// ????????????й?????????????? }

????}

???????С??

???????????????????????????????????????????????????????t????????????????????????????ù?????????????????????????????CLR??????????????????????????е??????