You must cast your ping object as IDisposable when you call Dispose (e.g. ((IDisposable)ping).Dispose() ). There is another seemingly empty Dispose method on the ping class that gets called if you don't cast, and you'll end up with a memory leak in your application if you use many of these classses (such as a monitor application that pings every x seconds).