An interface is just defines a contract.
From MSDN:
"13. Interfaces
Visual Studio .NET 2003
An interface defines a contract. A class or struct that implements an interface must adhere to its contract. An interface may inherit from multiple base interfaces, and a class or struct may implement multiple interfaces.
Interfaces can contain methods, properties, events, and indexers. The interface itself does not provide implementations for the members that it defines. The interface merely specifies the members that must be supplied by classes or structs that implement the interface."
So, you don't dispose of Interfaces per se, you dispose of the objects that implement them. You could have an object that looks like this
public class SomeDisposableObject : IMyCustomInterface, IDisposable
{
}
Now you could have a method that gets this reference as follows
IMyCustomInterface foo = new SomeDisposableObject ();
foo.Whatever();
((IDisposable)foo).Dispose();
That's not very clean though, it would be nicer if we could just use a using block around the interface. In which case, have your interface inherit IDisposable
public Interface IMyCustomInterface : IDisposable
{
void Whatever;
}
You can now use like
using (IMyCustomInterface bar = new SomeDisposableObject())
{
bar.Whatever();
}