I have this small program (the real program is of course very different).
using System;
namespace Finalizer
{
public class Simple
{
public Simple()
{
Console.WriteLine("Constructor");
}
~Simple()
{
Console.WriteLine("Finalizer");
}
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
var s = new Simple();
s = null;
GC.Collect();
Console.WriteLine("Collected");
Console.ReadKey();
}
}
}
And this is the output:
Hello World!
Constructor
Collected
I don't get why I don't see the Finalizer
line.
Anyone?