title: Cannot break out the foreach loop
body: <p>I am using a collection to add a list of employees with add and display function like below: </p>
  
  <pre><code>class Collection&lt;T&gt;
  {
      static List&lt;T&gt; list = new List&lt;T&gt;();
      public Collection()
      {
  
      }
  
      public bool Add(T obj, ref T u)
      {
          list.Add(obj);  
          return true;
      }
  
      public void Display()
      {
          bool s = false;
          foreach (T u in list)
          {
              Console.WriteLine(u.ToString());
              s = true;
              break;
          }         
      }
  </code></pre>
  
  <p>And a class that contains a menu :</p>
  
  <pre><code>public class EmployeeManagement : Employee
  {
      Collection&lt;Employee&gt; emp = new Collection&lt;Employee&gt;();
      public void MainMenu()
  
      {
          Console.WriteLine("1. Import Employee");
          Console.WriteLine("2. Display Employee Information");
          Console.WriteLine("3. Search Employee");
          Console.WriteLine("4. Exit");
          Console.WriteLine("Enter Menu Option Number: ");
          int choice = Convert.ToInt32(Console.ReadLine());
          do
          {
              switch(choice)
              {
              case 1:
                  ImportEmployee();
                  break;
              case 2:
                  emp.Display();
                  break;
              }
          } while (true);
  
  
      }
  
      public void AddEmployee(Employee u)
      {
          u.InputEmployee();           
          if (!emp.Add(u))
          {
              Console.WriteLine("88");
          }
      }
  
  
      public void ImportEmployee()
      {
  
          while (true)
          {
  
              Console.WriteLine("================== Import Employee ============");
              Console.WriteLine("1. Salaried Employee");
              Console.WriteLine("2. Hourly Employee");
              Console.WriteLine("3. Main Menu");
              int choice = Convert.ToInt32(Console.ReadLine());
              if (choice == 1)
              {
                  SalariedEmployee salEmployee = new SalariedEmployee();
                  AddEmployee(salEmployee);
              }
              else if (choice == 2)
              {
                  HourlyEmployee hourlyEmployee = new HourlyEmployee();
                  AddEmployee(hourlyEmployee);
              }
              else
              {
                  MainMenu();
                  break;
              }
              Console.ReadKey();
          }
  
      }
  }
  </code></pre>
  
  <p>I have added a new employee and it's has been added to my list. After that, I hit option 3 to go back to the main menu and choose display employee, it kept printing my list employee and cannot break out the loop. How can I fix this problem, I have tried to display in importemployee() menu and it worked without a problem.</p>