title: How can I reach my list in a different class from my Program class and then print it out?
body: <p>im trying to make a ToDo application in c#. I managed to make so that the user can add a task to the list. However i want to be able to print out the listItems in a foreach loop, but I dont know how to reach it.</p>
  <p>This is my Class with my list:</p>
  <pre><code>using System.Collections.Generic;
  
  namespace ToDo
  {
      public class TodoCollection
      {
          //Declaring my fields
          List&lt;Task&gt; _CurrentTasks = new List&lt;Task&gt;();
          List&lt;Task&gt; _ArchivedTasks = new List&lt;Task&gt;();
  
  
          //Method for user to add to the list
          public void Add(Task NewTask)
          {
              _CurrentTasks.Add(NewTask);
          }
      }
  }
  </code></pre>
  <p>This is my Program class where i want to print out all the listItems the user has entered:</p>
  <pre><code> while (isRunning)
              {
                  var menu = new menu();
                  menu.Title();
                  menu.Options();
                  switch (choices)
                  {
                      case 1:
                          var inputNewTask = Console.ReadLine();
                          var task = new Task(inputNewTask, false);
                          collection.Add(task);
                          // Console.WriteLine(task.ShowTask());
                          break;
                      case 2:
                          foreach(Task newTask in  ) 
                          {
  
                          }
                      break;    
                  }
  </code></pre>
  <p>As you can see my foreach statement is not done yet. I dont know  what I should put there for it to reach the list and then print it out.</p>
  <p>I also have a class of Tasks:</p>
  <pre><code>namespace ToDo
  {
      public class Task
      {
          string _Name;
          bool isDone = false;
          public Task(string name, bool done)
          {
              this._Name = name;
              this.isDone = done;
          }
  
  
          public string ShowTask()
          {
              return this._Name;
          }
      }
  }
  </code></pre>