下面代码输出结果是:
using System;
using System.Collections;
using System.Collections.Generic;
namespace TestDemo
{
class Program
{
class U
{
~U()
{
Console.WriteLine("removed");
}
public U()
{
throw new NotImplementedException();
}
}
private static void Foo()
{
try
{
var u = new U();
GC.Collect();
}
catch
{
Console.WriteLine("catch");
GC.Collect();
}
finally
{
Console.WriteLine("finally");
}
}
static void Main(string[] args)
{
Foo();
GC.Collect();
}
}
}