C# Program to read the content of a file

In this C# program, we will read the content of the Text file and print the content of the file.

C# Program to read the content of a file Code:

private static void Main(string[] args)
        {
            string contents = File.ReadAllText(@"C:\Temp.txt");
            Console.Write("Output: "+contents);
            Console.ReadLine();
        }

C# Program to read the content of a file Output:

CSharp-program-to-read-the-content-of-a-file

 
About Us | Terms of Use | Privacy Policy | Disclaimer | Contact Us Copyright © 2012-2024 CodingFusion
50+ C# Programs for beginners to practice