Saturday, April 26, 2025

C# OO - Read From and Write to a Text File

Program.cs

using System;
using System.IO;

namespace LearnCS
{
    class Program
    {        
        static void Main(string[] args)
        {
            string toFile = "I will be sent to external file";
            File.WriteAllText("external.txt", toFile);

            string fromFile = File.ReadAllText("external.txt");
            Console.WriteLine(fromFile);

            Console.ReadLine();
        }
    }
}

No comments:

Post a Comment

Tkinter Introduction - Top Widget, Method, Button

First, let's make shure that our tkinter module is working ok with simple  for loop that will spawn 5 instances of blank Tk window .  ...