C# conditional using block statement

后端 未结 10 1679
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-02 07:25

I have the follow code but it is awkward. How could I better structure it? Do I have to make my consuming class implement IDisposable and conditionally construct the network acc

10条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-02 08:00

    using scope will only dispose a object if the class implements IDisposible interface so yes you need to implement dispose method.

提交回复
热议问题