I need to insert an XML comment right at the beginning of an existing xml file (ie in the root) for users to see when they look at it in a text editor.
Basically I want to end up with something like this at the beginning...
<?xml version="1.0" encoding="utf-8"?>
<!--Don't mess with this file -->
....
Assunming I have read the file into an XDocument object and created a new XComment object, using Linq to XML what's the recommended approach to inject this at the start of the root element?
doc.AddFirst(comment), assuming doc is the XDocument and comment is the XComment object you have? I didn't see any drawback with that..