title: C# convert a long to string
body: <p>Here my problem is:</p>
  
  <p>I have this code:</p>
  
  <pre><code>static long CountLinesInFile(string f)
  {
      long count = 0;
      using (StreamReader r = new StreamReader(f))
      {
          string line;
          while ((line = r.ReadLine()) != null)
          {
              count++;
          }
      }
      return count;
  }
  </code></pre>
  
  <p>Which counts the lines of a text file. The problem I have is that when I'm trying this:</p>
  
  <pre><code>textBox1.Text = CountLinesInFile("test.txt");
  </code></pre>
  
  <p>I'm getting an error:</p>
  
  <pre><code>Error   1   Cannot implicitly convert type 'long' to 'string'
  </code></pre>
  
  <p>It seems legit, but how am I supposed to convert it to string? In Java its a simple <code>toString()</code></p>
  
  <p>Can someone give me a solution?</p>