using System; using System.Collections.Generic; using System.Text; public class MyResourceWrapper : IDisposable { public void Dispose() { Console.WriteLine("In Dispose() method!"); } } class Program { static void Main(string[] args) { MyResourceWrapper rw = new MyResourceWrapper(); if (rw is IDisposable) rw.Dispose(); using (MyResourceWrapper rw2 = new MyResourceWrapper()) { } } }