title: How to convert System.Decimal bits to string in C#?
body: <p>I'd like to be able to get the bits from a <code>System.Decimal</code> value and then convert that to the string representation of the value, much like <code>Decimal.ToString()</code> would do but I have a hard time coming up with the algorithm.</p>
  
  <p>So I have something like this:</p>
  
  <pre><code>decimal d = 1403.45433M;
  int[] nDecimalBits = decimal.GetBits(d);
  
  // How to convert the 4 integers in nDecimalBits to a string
  // that contains "1403.45433"?
  </code></pre>
  
  <p>I know the binary layout of the decimal - the first 3 integers contain the value bits and the last integer contains the sign bit and the scaling factor.</p>
  
  <p>I tried searching for the algorithm using various search terms but decimal is mostly used as a synonym for 'floating-point number' so my searches turned up answers to unrelated problems.</p>
  
  <p>Any help would be appreciated.</p>
  
  <p><strong>Edit</strong>: in response to some answers, I need to send the bits to a different platform where the value needs to be reconstructed. System.Decimal and any of its member functions are not available there, so I need to grab the bits and translate them to a string.</p>
  
  <p>If I had a choice, I'd obviously use <code>ToString()</code> but then I wouldn't need to ask.</p>