Using statement question

后端 未结 6 987
挽巷
挽巷 2021-01-13 04:03

I have two questions.

1) Should you always use a using statement on a connection? So, I would use it on the connection and then another one on a reader within the c

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-13 05:03

    1. You should always use a using statement when an object implements IDisposable. This includes connections.

    2. It will create two nested try{}finally{} blocks.

提交回复
热议问题