title: c# equivalent forVFP FileToStr()
body: <p>I'm migrating to c# from VFP and need help with <code>FileToStr(path)</code>, actually we have thousands of files stored into a database with this function, and for now we want to maintain compatibility with VFP.</p>
  
  <p>FileToStr() help at VFP help library doesn't say anything about what kind of Encoding perform with the file just </p>
  
  <pre><code>FILETOSTR(cFileName) = Returns the contents of a file as a character string.
  </code></pre>
  
  <p>For now this is a Black Box. I have two questions: </p>
  
  <p>There is a c# function that perform the same task as VFP <code>FileToStr()</code>?</p>
  
  <p>What Kind of encoding perform <code>FileToStr()</code> to the file?  </p>
  
  <p>Actually I have this function to convert the file:</p>
  
  <pre><code>public async Task&lt;string&gt; ImageToStrAsync(string path)
  {
      string BitmapToImage = await Task.Factory.StartNew(() =&gt;
           {
               Bitmap bm = new Bitmap(path);
               TypeConverter cv = TypeDescriptor.GetConverter(typeof(Bitmap));
               return Convert.ToBase64String(
                       (byte[])cv.ConvertTo(bm, typeof(byte[]))
                   );
           });
  
      return BitmapToImage;
  }
  </code></pre>