title: Double 2 Decimal Places
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/4258964/how-to-round-and-format-a-decimal-correctly">How to round and format a decimal correctly?</a>  </p>
  </blockquote>
  
  
  
  <p>I have this:</p>
  
  <pre><code>double xValue = 0.0;
  double yValue = 0.0;
  
  foreach (var line in someList)
  {
      xValue = Math.Round(Convert.ToDouble(xDisplacement - xOrigin), 2);
      yValue= Math.Round(Convert.ToDouble(yDisplacement + yOrigin), 2);
  
      sw.WriteLine("( {0}, {1} )", xValue, yValue);
  
  }
  </code></pre>
  
  <p>When it does that math it is suppose to round to 2 decimal places.</p>
  
  <h2><strong>HOWEVER</strong>,</h2>
  
  <p>..When a number is something like <em>6.397</em> it will round it to <em>6.4</em> and not include the trailing <strong>"0"</strong>. </p>
  
  <p>How can I add the <strong>"0"</strong> at the end of the number?</p>
  
  <p>If I add this to <strong>BEFORE</strong> (unless there is a better way to do it?) the <em>foreach loop</em> above...:</p>
  
  <pre><code>string properX = xValue.ToString().Replace(".", "");
  string properY = yValue.ToString().Replace(".", "");
  </code></pre>
  
  <p>How would I go about doing this?</p>