开发者

SqlCeResultSet.Close - Do I need to call it?

开发者 https://www.devze.com 2023-01-06 01:57 出处:网络
I 开发者_开发技巧have seen some examples that after data is read using SqlCeResultSet that a Close is called.

I 开发者_开发技巧have seen some examples that after data is read using SqlCeResultSet that a Close is called.

Do I really need to call close? What are the drawbacks if I don't close it? (does something else bad happen? Do I get memory leaks?....)


Yes, you do need to Close your result sets; otherwise, you may leak native resources.

You should simply use a using block.


The drawback if you don't close the result set yourself is that the resources won't be freed until the garbage collector gets around to it. A lot of garbage collectors are lazy, so who knows when that will be!

0

精彩评论

暂无评论...
验证码 换一张
取 消