Esempio n. 1
0
 public void SaveToFile(Remainder remainder, string filename, bool overwrite = false)
 {
     if (overwrite || File.Exists(filename))
     {
         File.WriteAllText(filename, remainder.ToString());
     }
 }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("SingleRespnsibility Principle/Pattern");

            Remainder rem = new Remainder();

            rem.AddRemainders("Make Tea at 11");
            rem.AddRemainders("Meeting at 12");
            rem.AddRemainders("Lunch at 1");

            Console.WriteLine(rem);

            Persistance persistance = new Persistance();
            string      filename    = @"D:\remainders.txt";

            persistance.SaveToFile(rem, filename, true);
        }