title: Converting string to byte array in C#
body: <p>I'm converting something from VB into C#. Having a problem with the syntax of this statement:</p>
  
  <pre><code>if ((searchResult.Properties["user"].Count &gt; 0))
  {
      profile.User = System.Text.Encoding.UTF8.GetString(searchResult.Properties["user"][0]);
  }
  </code></pre>
  
  <p>I then see the following errors:</p>
  
  <blockquote>
    <p>Argument 1: cannot convert from 'object' to 'byte[]'</p>
    
    <p>The best overloaded method match for
    'System.Text.Encoding.GetString(byte[])' has some invalid arguments</p>
  </blockquote>
  
  <p>I tried to fix the code based on <a href="https://stackoverflow.com/questions/10180864/converting-byte-array-to-string-not-working-in-c-sharp">this</a> post, but still no success</p>
  
  <pre><code>string User = Encoding.UTF8.GetString("user", 0);
  </code></pre>
  
  <p>Any suggestions?</p>