.

Simple File Read to String and Write String To File C# Methods

using System.IO;

        public static string LoadFromFile(string filename)
        {
            StreamReader streamReader = new StreamReader(filename);
            string text = streamReader.ReadToEnd();
            streamReader.Close();
            return text;
        }

        public static void WriteToFile(string filename, string text)
        {
            StreamWriter streamWriter = new StreamWriter(File.Create(filename));
            streamWriter.Write(text);
            streamWriter.Close();
        }

What's your thoughts on this?

*

Protected by WP Anti Spam