title: Using an int as the numerical representation of a string in C#
body: <p>I'm trying to use an integer as the numerical representation of a string, for example, storing "ABCD" as 0x41424344.  However, when it comes to output, I've got to convert the integer back into 4 ASCII characters.  Right now, I'm using bit shifts and masking, as follows:</p>
  
  <pre><code>int value = 0x41424344;
  string s = new string (
                new char [] { 
                   (char)(value &gt;&gt; 24), 
                   (char)(value &gt;&gt; 16 &amp; 0xFF),
                   (char)(value &gt;&gt; 8 &amp; 0xFF),
                   (char)(value &amp; 0xFF) });
  </code></pre>
  
  <p>Is there a cleaner way to do this?  I've tried various casts, but the compiler, as expected, complained about it.</p>