2016-04-19 7 views
0

私は例えば、いくつかのクラスを持っている:シリアライザで生成されたxmlにコメントを挿入するには?

Public Class MyClass 
    Public Property MyProperty As Integer = 1 
End Class 

シリアライザ(Xml.Serialization.XmlSerializer)が作成したXML:

<?xml version="1.0" encoding="utf-8"?> 
<MyClass xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
    <MyProperty>1</MyProperty> 
</MyClass> 

私はこのようなシリアライザ気にいらから取得できます:

<?xml version="1.0" encoding="utf-8"?> <MyClass xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
    <!-- Use positive values less than 10 --> 
    <MyProperty>1</MyProperty> 
</MyClass> 

ありがとう!

+4

ルック属性http://stackoverflow.com/questions/7385921/how-to-write [XMLCOMMENT(値= "コメント")] を使用するようにしてください-a-comment-to-an-xml-file-when-xmlserializerを使用している場合) – Icemanind

答えて

0

([このSO質問]で