IDisposable Question

前端 未结 8 1651
野的像风
野的像风 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.

    0 讨论(0)
  • 2021-01-11 19:32

    IDisposable has one member, Dispose().

    This is called when you choose to call it. Most typically that's done for you by the framework with the using block syntactic sugar.

    0 讨论(0)
提交回复
热议问题