namespace GarbageCollection_CS
{
using System;
using GarbageCollection_CLI;
class Program
{
static void Main(string[] args)
{
// Perform operations
var holder = PerformOperations();
// Verify the object still exists in the holder
Console.WriteLine("Object exists within holder: {0}", holder.ObjectExists);
// Wait for user exit
Console.WriteLine("Press any key to continue...");
Console.ReadKey();
}
static ObjectHolder PerformOperations()
{
// Create an object
object o = new object();
Console.WriteLine("Object has been created.");
// Pass the object to the C++/CLI code
ObjectHolder holder = new ObjectHolder(o);
Console.WriteLine("Holder has been created.");
return holder;
}
}
}