bru*_*nde 30
你可以使用XmlWriter和WriteProcessingInstruction:
XmlSerializer s = new XmlSerializer(typeof(myObj));
using (XmlWriter w = XmlWriter.Create(@"c:\test.xml"))
{
w.WriteProcessingInstruction("xml-stylesheet", "type=\"text/xsl\" href=\"USED-FILE.xsl\"");
s.Serialize(w, myObj);
}
Run Code Online (Sandbox Code Playgroud)