sthay
sthay

Reputation: 495

Linq to XML: XElement.Save to file

what is the right way of using XElement.Save(filepath)? Do I need to call this in a try/catch block all the time? How does it deal with concurrency?

Upvotes: 3

Views: 3644

Answers (1)

Jon Skeet
Jon Skeet

Reputation: 1499770

Exceptions: the normal policy - catch anything you can sensibly deal with (which is relatively rare) and let anything else bubble up the stack.

Concurrency: I wouldn't expect LINQ to XML to be threadsafe to start with. If you're updating the same element from multiple threads, use appropriate locking.

Upvotes: 3

Related Questions