title: C# Convert a string to ASCII bytes
body: <p>I have a string:</p>
  
  <pre><code>LogoDataStr = "ABC0000"
  </code></pre>
  
  <p>I want to convert to ASCII bytes and the result should be:</p>
  
  <pre><code>LogoDataBy[0] = 0x41;
  LogoDataBy[1] = 0x42;
  LogoDataBy[2] = 0x43;
  LogoDataBy[3] = 0x30;
  LogoDataBy[4] = 0x30;
  LogoDataBy[5] = 0x30;
  LogoDataBy[6] = 0x30;
  </code></pre>
  
  <p>I've tried using this way:</p>
  
  <pre><code>byte[] LogoDataBy = ASCIIEncoding.ASCII.GetBytes(LogoDataStr);
  </code></pre>
  
  <p>But the result I get is this:</p>
  
  <pre><code>LogoDataBy[0] = 0x41;
  LogoDataBy[1] = 0x42;
  LogoDataBy[2] = 0x43;
  LogoDataBy[3] = 0x00;
  LogoDataBy[4] = 0x00;
  LogoDataBy[5] = 0x00;
  LogoDataBy[6] = 0x00;
  </code></pre>
  
  <p>Is there any wrong with my coding?</p>