User Tools

Site Tools

blog:2023-10-02_c_read_a_file_line-by-line



2023-10-02 C#: Read a File Line-by-Line

  • Example
  • using System;
    using System.IO; 
    public class Example
    {
        public static void Main()
        {
            string fileName = @"C:\test.txt";
     
            string _text = File.ReadAllText(fileName);
            string[] _lines = _text.Split('\n');
     
            foreach (string _line in _lines) {
                Console.WriteLine(_line);
            }
        }
    }

TAGS

  • 50 person(s) visited this page until now.

Permalink blog/2023-10-02_c_read_a_file_line-by-line.txt · Last modified: 2023/10/02 17:15 by jethro

oeffentlich