Linq to XML: XElement.Save to file

What is the correct way to use XElement.Save (file path)? Do I need to call this all the time in the try / catch block? How does this work with concurrency?

+3
source share
1 answer

Exceptions: the usual policy - catch everything that you can reasonably handle (which is relatively rare), and let something else bubble up on the stack.

Concurrency: I would not expect LINQ to XML to become thread safe for starters. If you are updating the same item from multiple threads, use the appropriate lock.

+3
source

Source: https://habr.com/ru/post/1699366/


All Articles