title: Sort multiple lists based on one list C#
body: <p>Object structure
  A class has multiple lists of data.
  <code>Class
  List1 of double
  List2 of double
  List3 of double 
  List4 of double</code></p>
  
  <p><strong>Objective:</strong> Sort multiple lists based on one list. E.g. <code>List1</code> in ascending order and all other lists to follow that order to maintain individual point relativity based on index.</p>
  
  <p>Initial implementations that I have tried are:</p>
  
  <ol>
  <li>Zip <code>List2</code>, 3 and 4 with List 1 and then sort based on List 1. Then combine sorted lists again.</li>
  </ol>
  
  <p><strong>e.g.</strong> </p>
  
  <pre><code>    var x1 = testData.SelectMany(d =&gt; d.xData).ToList();
      var y1 = modelData.SelectMany(d =&gt; d.yData).ToList();
      var y2 = modelData.SelectMany(d =&gt; d.y2Data).ToList();
      var sampleValues = x1.Zip(y1, (x, y) =&gt; new { X = x, Y = y }).OrderBy(v =&gt; v.X);
      var sampleValues1 = x1.Zip(y2, (x, y) =&gt; new { X = x, Y2 = y }).OrderBy(v =&gt; v.X);`
  
  //Next select X, Y from sampleValues and select Y2 from sampleValue2
  </code></pre>
  
  <ol start="2">
  <li>Tried using <code>SelectMany</code> on different lists and then put that into an anonymous type. <code>SelectMany</code> does not work with this as it needs definite data type to return.</li>
  </ol>
  
  <p>Anything that I am missing in these approaches or there is another approach required to get what I am trying to achieve.</p>
  
  <p>Also having a class with all this data or lists as individual rows and data inside columns is not an option for me.
  This is because I have a list of objects having these properties. So eventually I want to merge list data across objects sampleData lists and then sort and use that data.</p>
  
  <p>Feel free to let me know in case further information is required.</p>