Explicit interface implementation:
public class Foo : IDisposable {
void IDisposable.Dispose() { /* code here */ }
}
This can be done with any interface method. The using
API knows to use the IDisposable
implementation.
Note that this feature should not be over-used; the following would be confusing, for example:
public class Foo : IDisposable {
void IDisposable.Dispose() { /* do something */ }
public void Dispose() { /* do something completely different */ }
}