title: (C#) How to list all user-inputted integers in an array?
body: <p>I'm working on an application that has the user choose how many integers to enter into an array, and then has them input the numbers to be added to the array. After each number is inputted, it shows all non-duplicate integers entered by the user up to that point in a vertical list.  If it isn't unique, it informs the user that it has already been inputted.</p>
  
  <p>I'm not sure how to make the application list every integer entered, rather than just the most recent one.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>static void Main(string[] args) 
  {
      //checks how many numbers will be entered
      int manyNumbers;
      Console.WriteLine("How many numbers will you enter?");
      manyNumbers = Convert.ToInt32(Console.ReadLine());
      int[] array = new int[manyNumbers];
      //starts asking for numbers
      for (int i = 0; i &lt; manyNumbers;) 
      {
          Console.Write("\nEnter number: ");
          string entered = Console.ReadLine();
          int val;
          //checks to see if valid number
          if (!Int32.TryParse(entered, out val))
          {
              Console.Write("Invalid number '{0}'", entered);
              array[i++] = val;
          }
          //checks to see if already entered
          else if (i &gt; 0 &amp;&amp; array.Take(i).Contains(val))
          {
              Console.Write("{0} has already been entered", val);
              array[i++] = val;
          }
          //prints inputted integer
          else {
              array[i++] = val;
              Console.WriteLine("{0}", val);
          }
      }
  }
  </code></pre>