title: How to remove multiple if-else or repetitive ternary operations?
body: <p>I want to make the following function using DRY principle. </p>
  
  <pre><code>private void DetermineLeftAndRightPoint(Coordinate coordinate1, Coordinate coordinate2)
  {
      // If false, then parallel to Y axis
      if (IsParallelToXAxis == true)
      {
          LeftPoint = coordinate1.X &lt; coordinate2.X ? coordinate1 : coordinate2;
          RightPoint = coordinate1.X &lt; coordinate2.X ? coordinate2 : coordinate1;
          return;
      }
  
      LeftPoint = coordinate1.Y &lt; coordinate2.Y ? coordinate1 : coordinate2;
      RightPoint = coordinate1.Y &lt; coordinate2.Y ? coordinate2 : coordinate1;
  }
  </code></pre>
  
  <p>I tried to create another function with 'out' parameters for determining the Left and Right point for when the segment is parallel to X or Y but then again I had to choose the X/Y parameter using if-else. Is there a better way to write the function?</p>