using System;
public class Program
{
public static void Main(string[] args)
{
using(Dog dog = new Dog())
{
}
}
public class Dog : IDisposable
{
public bool isDisposed;
public Dog()
{
Console.WriteLine("Constructor");
}
public void Dispose()
{
this.Dispose(true);
}
protected void Dispose(bool disposing)
{
if (!this.isDisposed)
{
Console.WriteLine("Deconstructor");
}
this.isDisposed = true;
}
~Dog()
{
this.Dispose(false);
}
}
}
using System;
public class Program
{
public static void Main (String [] args)
{
Dog A = new Dog();
Console.WriteLine("test");
}
}
class Dog
{
public Dog()
{
Console.WriteLine("Constructor");
}
~Dog()
{
Console.WriteLine("Deconstructor");
}
}