C the method of reading the whole file contents into string variables

  • 2021-07-09 09:05:55
  • OfStack

This article illustrates how C # reads the whole file contents into string variables. Share it for your reference. The specific implementation method is as follows:


using System;
namespace PlayingAround {
 class ReadAll {
  public static void Main(string[] args) {
   string contents = System.IO.File.ReadAllText(@"C:\t1");
   Console.Out.WriteLine("contents = " + contents);
  }
 }
}

I hope this article is helpful to everyone's C # programming.


Related articles: