title: Compare a string read by network stream
body: <p>I'm programming a telnet admin system that request to user to input a command.</p>
  
  <p>I can read it from the socket with a network stream but when I compare the string to another I can't get a match, i have tried Regex..</p>
  
  <p>So here is my code:</p>
  
  <pre><code>while (!bit.Contains("\r") &amp;&amp; !bit.Contains("\n") &amp;&amp; !bit.Contains("."))
  {
      bit = Encoding.ASCII.GetString(buffer);
      outputString += bit;
      stream.Read(buffer, 0, 1);
  }
  
   // Read till user input ENTER
  
  if ( outputString == "$edit" )
       // do something
  </code></pre>