开发者

Do I need to dispose/close XDocument.Load(string)?

开发者 https://www.devze.com 2023-01-15 06:55 出处:网络
I can\'t find any info about whether or not I s开发者_JAVA技巧hould dispose/close this object after using it... Here is the msdn link: http://msdn.microsoft.com/en-us/library/bb343181.aspxNo, you don\

I can't find any info about whether or not I s开发者_JAVA技巧hould dispose/close this object after using it... Here is the msdn link: http://msdn.microsoft.com/en-us/library/bb343181.aspx


No, you don't - it doesn't even implement IDisposable. The XDocument and XElement classes use XmlReader under the covers and handle the disposing of the underlying reader for you.


Easiest way to find out is to look if it implements IDisposable

0

精彩评论

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