fork download
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace ConsoleApplication1
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. var hoges = new List<Hoge>();
  11. hoges.Add(new Hoge());
  12.  
  13. hoges = null;
  14. GC.Collect();
  15. }
  16. }
  17.  
  18. class Hoge
  19. {
  20. public Hoge()
  21. {
  22. Console.WriteLine("Hogeは生まれた");
  23. }
  24.  
  25. ~Hoge()
  26. {
  27. Console.WriteLine("Hogeは死んだ");
  28. }
  29. }
  30. }
  31.  
Success #stdin #stdout 0.03s 33864KB
stdin
Standard input is empty
stdout
Hogeは生まれた