>public void SomeMethod(ISomeInterface theObject) >{ > // do something with theObject > // and if theObject implements IDisposable > // dispose it >}Can't think of anything beyond the obvious:
if (theObject is IDisposable) ((IDisposable)theObject).Dispose(); //or IDisposable d = theObject as IDisposable; if (d != null) d.Dispose();But presumably you've seen something else ? :-}