namespace DispTest { using System; public class Bod : IDisposable { bool disposed = false; int id; public Bod( int id ) { Console.WriteLine( "Construct Bod with id {0}", id ); this.id = id; } public virtual void Dispose( bool disposing ) { if( !this.disposed ) { if( disposing ) { Console.WriteLine( "A - Disposing {0}", id ); } Console.WriteLine( "B - Disposing {0}", id ); } this.disposed = true; } public void Dispose() { Dispose( true ); GC.SuppressFinalize(this); } ~Bod() { Dispose( false ); Console.WriteLine( "Distructing" ); } public static void Main() { using( Bod a = new Bod(1) ) { Console.WriteLine( "Inside using with 'a'" ); } Bod b = new Bod(2); Console.WriteLine( "End" ); } } }