Are there any side effects of returning from inside a using() statement?

前端 未结 5 1331
一向
一向 2021-01-31 07:02

Returning a method value from inside a using statement that gets a DataContext seems to always work fine, like this:

public sta         


        
5条回答
  •  执笔经年
    2021-01-31 07:27

    I think, it's all the same. There's nothing bad in the code. The .NET framework wouldn't care where the object is created. The thing that matters is whether it is referenced or not.

提交回复
热议问题