在C#中你可以这样做:
interface YourInterface: IDisposable {
/// your methods
}
Run Code Online (Sandbox Code Playgroud)
一个实现的类YourInterface也应该实现IDisposable方法.
当然,这是有效的:
YourInterface implementation = new Implementation();
IDiposable disposable = implementation;
Run Code Online (Sandbox Code Playgroud)