Serialize XmlDoc comments with data

I have a serializable class that I would like to serialize with its data (of course), as well as with its XmlDoc comments. Does anyone know of an existing library that does this work, or at least part of it?

Reading XmlDoc C # code like Intellisense does is a good starting point.

Since examples are better than theory, I would like to have the following code (C #)

public class ApplicationOptions : ISerializable { ///<summary>This parameter describes the X property</summary> public int WindowPositionX; ///<summary>This comment is the same as in the XML-serialized form</summary> public int WindowPositionY; } 

The following serialized XML form is displayed

 <!--This parameter describes the X property--> <parameter name="WindowPositionX" Value=12 /> <!--This comment is the same as in the XML-serialized form--> <parameter name="WindowPositionY" Value=13 /> 
+4
source share
1 answer

I don’t know of any library that does this, you can write your own serializer for the class and add comments using a custom serializer, as it is done here: How to write a comment in an XML file when using XmlSerializer?

But you will need to read the file for the companion file yourlibraryfile.xml in order to get comments, comments are not compiled with the application.

+2
source

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


All Articles