开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜