亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

理解.NET中的垃圾收集

理解.NET中的垃圾收集

慕慕森 2019-05-30 10:49:13
理解.NET中的垃圾收集考慮以下代碼:public class Class1{     public static int c;     ~Class1()     {         c++;     }}public class Class2{     public static void Main()     {         {             var c1=new Class1();             //c1=null; // If this line is not commented out, at the Console.WriteLine call, it prints 1.         }         GC.Collect();         GC.WaitForPendingFinalizers();         Console.WriteLine(Class1.c); // prints 0         Console.Read();     }}現在,即使main方法中的變量c1超出了作用域,并且沒有被任何其他對象進一步引用GC.Collect()是叫,為什么還沒最后確定呢?
查看完整描述

3 回答

  • 3 回答
  • 0 關注
  • 490 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號