Share Link
Copied to clipboard
Embed on Your Page
Copied to clipboard
We Stand with Ukraine
[Fork] questions/7385921/how-to-write-a-comment-to-an-xml-file-when-using-the-xmlserializer by dbc_MinLength
Environment version: 4.0.30319.42000


Serialized Foo
<?xml version="1.0" encoding="utf-16"?>
<Foo>
  <!--The application version, NOT the file version!-->
  <Version>1.0</Version>
  <!--The application name, NOT the file name!-->
  <Name>Bar</Name>
</Foo>

Deserialized and re-serialized Foo
<?xml version="1.0" encoding="utf-16"?>
<Foo>
  <!--The application version, NOT the file version!-->
  <Version>1.0</Version>
  <!--The application name, NOT the file name!-->
  <Name>Bar</Name>
</Foo>
Cached Result
Last Run: 5:05:04 pm
Compile: 0.142s
Execute: 0.219s
Memory: 1Mb
CPU: 0.234s