csharp

csharp

Published on August 12, 2024By DeveloperBreeze

C#: How to Read a File

using System;
using System.IO;

class ReadFileExample
{
    static void Main()
    {
        string path = @"C:\example.txt";
        string text = File.ReadAllText(path);
        Console.WriteLine(text);
    }
}

Comments

Please log in to leave a comment.