title: C# ArrayList Print and sum values
body: <p>I have the following code, the user enter values to the arraylist, than i am trying to print the array value (if the user add 999) and sum the values of the arraylist
  i must use arraylist because that is what i was asked to do (so please don't suggest to use another kind of array)</p>
  
  <pre><code>        ArrayList myArray = new ArrayList();
          int num1 = 0;
          int sum = 0;
          while (num1 != 999)
          {
              num1 = int.Parse(Console.ReadLine());
              myArray.Add(num1);
              foreach (int i in myArray)
              {
                  sum = sum + i;
              }
          }
  
          Console.WriteLine(myArray);
          Console.WriteLine(sum);
  </code></pre>
  
  <p>The problem is, when i am trying to prin the arraylist values it print instead the following text:
  System.Collections.ArrayList</p>
  
  <p>And instead of printing the sum of all values (for example the values are 1,2,3) he print the sum 1015 instead of 6.</p>
  
  <p>Will appreciate any help, Thanks!</p>