IDisposable Question

前端 未结 8 1662
野的像风
野的像风 2021-01-11 18:35

Say I have the following:

public abstract class ControlLimitBase : IDisposable 
{
}

public abstract class UpperAlarmLimit : ControlLimitBase 
{
}

public cl         


        
8条回答
  •  失恋的感觉
    2021-01-11 19:29

    when using an IDisposable object, it's always good to use it this way:

    using(var disposable = new DisposableObject())
    {
        // do you stuff with disposable
    }
    

    After the using block has been run, the Dispose method will be called on the IDisposable object. Otherwise you would need to call Dispose manually.

提交回复
热议问题