title: How do you convert a string to ascii to binary in C#?
body: <p>A while back (freshman year of high school) I asked a really good C++ programmer who was a junior to make a simple application to convert a string to binary. He gave me the following code sample:</p>
  
  <pre><code>void ToBinary(char* str)
  {
      char* tempstr;
      int k = 0;
  
      tempstr = new char[90];
  
      while (str[k] != '\0')
      {
          itoa((int)str[k], tempstr, 2);
          cout &lt;&lt; "\n" &lt;&lt; tempstr;
          k++;
      }
  
      delete[] tempstr;
  }
  </code></pre>
  
  <p>So I guess my question is how do I get an equivalent to the itoa function in C#? Or if there is not one how could I achieve the same effect?</p>