//Use the Singleton Pattern.
//The Runner class creates two instances of the Singleton class (object) and compares these instances to prove they are identical and that only one version of the class (object) exists.
Console.WriteLine("Getting singleton 1.");
var instance1 = Singleton.Instance;
instance1.Item = "Hello World!";
Console.WriteLine($"Got singleton 1 {instance1}.");
Console.WriteLine();
Console.WriteLine("\nGetting singleton 2.");
var instance2 = Singleton.Instance;
instance2.Item = "Foo";
Console.WriteLine($"Got singleton 2 {instance2}.");
if (instance1 == instance2)
{
Console.WriteLine();
Console.WriteLine("Instance 1 and Instance 2 are equal");
}
Console.WriteLine($"Instance 1, Item = {instance1.Item}.");
Console.WriteLine($"Instance 2, Item = {instance2.Item}.");