title: How can I convert characters and string to a byte array?
body: <p>Having trouble converting the characters into a string to get the bytes than use an array to send through serial port.</p>
  
  <pre><code>   const char STX = '\u0002';
     const char ETX = '\u0003';
     string pull_shelf_104 = ( STX + "01P00104##" + ETX);
  
     private byte[] WrapString(string pull_shelf_104)
     {
         int length = pull_shelf_104.Length;
         byte[] send104 = new byte[length];
         Array.Copy(System.Text.Encoding.ASCII.GetBytes(pull_shelf_104), 0, send104, 0, length);
         return send104;
     }
  
     private void linkLabel_HC1_100_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
     {
         if (serialPort1.IsOpen)
         {
             byte data = WrapString(string pull_shelf_104);
             serialPort1.Write(data,0,1);
         }
     }
  </code></pre>