title: C# - Using LINQ to take two variables into a 2-dimensional array?
body: <p>I have a list&lt;> of an "region" class with two variables, "startLocation" and "endLocation".
  I'd like to combine those two into a new sorted 2 dimensional array where its just Location and an integer representing whether its start or an end.</p>
  
  <p>For example, if the list has three region objects with</p>
  
  <blockquote>
    <p>[Region 1] : startLocation = 5,
    endLocation = 7</p>
    
    <p>[Region 2] : startLocation = 3,
    endLocation = 5</p>
    
    <p>[Region 3] : startLocation = 8,
    endLocation = 9</p>
  </blockquote>
  
  <p>I'd like to get a sorted two dimensional array (or list or similar) looking like:</p>
  
  <blockquote>
    <p>[3]  [1]</p>
    
    <p>[5]  [1]</p>
    
    <p>[5]  [-1]</p>
    
    <p>[7]  [-1]</p>
    
    <p>[8]  [1]</p>
    
    <p>[9]  [-1]</p>
  </blockquote>
  
  <p>(preferably i'd like the overlaps to add their second values together, so the two separate 5's in the array would be combined into [5  0]...but that's not too important)</p>
  
  <p>I'm currently using a regular forloop going through each one by one and adding them to a list one at a time. This implementation is quite slow because I'm working with large datasets, and I'm guessing there's a more elegant / faster way to accomplish this through LINQ.</p>
  
  <p>Any suggestions would be much appreciated.</p>