什么时候应该使用"使用"在C#块?什么时候、QUOT

2023-09-02 20:40:55 作者:执念虐心

有没有我应该在哪里(或不应该?)使用使用块特定的实例:

 使用(SOMETYPE T =新SOMETYPE()){
    ...
}
 

解决方案

SOMETYPE 类实现IDisposable.

不用去排队啦 养老保险补缴费,可以这样做

Are there particular instances where I should (or shouldn't?) be using "using" blocks:

using(SomeType t = new SomeType()){
    ...
}

解决方案

When the SomeType class implements IDisposable.