title: Why does VS sort XML class childs alphabetical, and how to avoid that?
body: <p>I've wrote a .cs file in a predefined structure to read in a specific type of XML files. That file has a lot more classes underneath. Round about 67 at this time.</p>
  <p><a href="https://i.stack.imgur.com/sUa1n.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sUa1n.png" alt="enter image description here" /></a></p>
  <p>This is my code to read in the .tcx files which are XML files.</p>
  <pre><code>        ModelData _xmlConfigData = new ModelData();
          XmlSerializer _xmlSerializer = new XmlSerializer(typeof(ModelData));
  
          try
          {
              using (FileStream filestream = new FileStream(xmlFilePath, FileMode.Open, FileAccess.Read))
              {
                  _xmlConfigData = (ModelData)_xmlSerializer.Deserialize(filestream);
              }
          }
          catch (Exception ex)
          {
              MessageBox.Show(&quot;Wrong XML structure read in. Please select another XML file:&quot; + ex);
              _xmlConfigData = null;
          }
          InvokeExtension.CreateListboxEntry(InvokeExtension.INFO + &quot;TCX read successful&quot;, _lBox);
          InvokeExtension.SetProgressbarValue(1000, _pBar);
  </code></pre>
  <p>There are no errors at reading the hundreds of thousands of lines. But, if I look at my class object (at debugging) the subclasses are listed alphabetically sorted. The only thing I do is to read the .tcx into a ModelData-class-object and write it out to a new file.
  This is my writer code:
  <a href="https://i.stack.imgur.com/oxXzz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oxXzz.png" alt="enter image description here" /></a></p>
  <p>After writing the new file the XML structure looks perfect, but <strong>some of the child elements are now sorted in other direction compared to the original file. This is causing problems. I don't know why and how to prevent that sorting of the child nodes.</strong> In my opinion it doens't matter in which sequence the child nodes are in an XML file.</p>