11

I can't find any info about whether or not I should dispose/close this object after using it... Here is the msdn link: http://msdn.microsoft.com/en-us/library/bb343181.aspx

2 Answers 2

27

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.

0
8

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

2
  • 1
    And, the easiest way to do that is with 'Go To Definition', 'Object Browser' or Reflector
    – Bertvan
    Sep 9, 2010 at 20:28
  • Sure, that's a good/simple way to do this... I really couldn't find a dispose of close method, so I'm under the assumption that like Andrew said, this is really handled by the XDocument class it self. Thanks for your quick answer. Sep 9, 2010 at 20:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.