using System;
class MainClass
{
static void Main()
{
MainClass myGCCol = new MainClass();
Console.WriteLine("The highest generation is {0}", GC.MaxGeneration);
myGCCol.MakeSomeGarbage();
Console.WriteLine("Generation: {0}", GC.GetGeneration(myGCCol));
Console.WriteLine("Total Memory: {0}", GC.GetTotalMemory(false));
GC.Collect(0);
Console.WriteLine("Generation: {0}", GC.GetGeneration(myGCCol));
Console.WriteLine("Total Memory: {0}", GC.GetTotalMemory(false));
GC.Collect(2);
Console.WriteLine("Generation: {0}", GC.GetGeneration(myGCCol));
Console.WriteLine("Total Memory: {0}", GC.GetTotalMemory(false));
}
void MakeSomeGarbage()
{
Version vt;
for (int i = 0; i < 10000; i++)
{
vt = new Version();
}
}
}