INDEX

C# - text file read

Displayed on the screen to read the text file

using System;
using System.IO;
using System.Text;

class Study {
  static void Main() {

    StreamReader sr = new StreamReader(
        "sample.txt", Encoding.GetEncoding("Shift_JIS"));

    string text = sr.ReadToEnd();

    sr.Close();

    Console.Write(text);
  }
}


Copyright(c) 2007-2023 coding.dojeun.com All Rights Reserved.