Why is my c# code not working? : <p>I have made a console program in c# that is like a to-do task manager.<br>
But it does not work when a certain code is reached:</p>

<pre><code>using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace To_Do_List
{
class Program
{
    static void Main(string[] args)
    {
        string path = @"C:\ToDoTask.txt";
        Console.WriteLine("To-do program");
        while (true)
        {
            if (Console.ReadLine() == "exit")
            {
                Environment.Exit(0);
            }

            if (Console.ReadLine() == "add")
            {
                Console.WriteLine("Please write your task and then press enter");
                string task = Console.ReadLine();
                Console.WriteLine("Task added");
                try
                {
                    StreamWriter sw = new StreamWriter(path);
                    sw.WriteLine(task);
                }
                catch
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Error: could not write task to file");
                    Console.ResetColor();
                }
            }

            if (Console.ReadLine() == "show")
            {
                try
                {
                    Console.WriteLine("Tasks:");
                    StreamReader sr = new StreamReader(path);
                    if (sr.ReadToEnd() != "")
                    {
                        Console.WriteLine(sr.ReadToEnd());
                    }
                    else
                    {
                        Console.WriteLine("No tasks left");
                    }
                }
                catch
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Error: could not read tasks file");
                    Console.ResetColor();
                }
            }

            if (Console.ReadLine() == "help")
            {
                Console.WriteLine("Write 'add' to add a new task");
                Console.WriteLine("Write 'show' to see current tasks");
                Console.WriteLine("Write 'exit' to exit program");
            }
        }
      }
    }
}
</code></pre>

<p>I am new programming and I can't find the error.
When I write add, show or exit, or help nothing happens.
Thanks.</p>
