开发者

SqlCeResultSet.Close - Do I need to call it?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜