XML serialization - Attributes - The sequence of attributes RRS feed

  • Question

  • Hello,
    I use the XML serialization. So far well, files are being written.
    How can I sort the attributes, order of listing. From what does it depend?
      <Side referencePos="0" referenceState="ProcessedNot" no="Side1" isExcecuted="NoState">
    	  <BOARD index="001" isReference="false" timeEnd="-">
      <Side no="Side1" written="xcvfrwwqw" referenceState="ProcessedNot"  isExcecuted="NoState">
    	  <BOARD index="001" isReference="false" timeEnd="-">
    public class Side
    	public Side No { get; set; }
    	public string PanelCodeWritten { get; set; }
    	public StatePosition ReferenceState;
    	public Executed IsExcecuted { get; set; }
    Thanks in advance for your answers.
    Greetings Markus

    Wednesday, November 6, 2019 5:40 PM


  • You can't control that, and you don't need to.  The order of XML attribute is, by definition, not important.  Those two XML files will both work equally well.

    Tim Roberts | Driver MVP Emeritus | Providenza &amp; Boekelheide, Inc.

    • Marked as answer by Markus Freitag Thursday, November 7, 2019 7:14 AM
    Wednesday, November 6, 2019 9:10 PM