class Sample<T> : IDisposable // case A
{
public void Dispose()
{
throw new NotImplementedException();
}
}
class SampleB<T> where T : IDisposable // case B
{
}
class SampleC<T> : IDisposable, T : IDisposable // case C
{
public void Dispose()
{
throw new NotImplementedException();
}
}
案例C是案例A和案例B的結合。這可能嗎? 如何使案例C正確?如何定義實現接口並約束類型參數的泛型類?