title: C# ArrayList.Add Method Adds Ref to Items?
body: <p>0Suppose I have created an ArrayList and added two strings as such:</p>
  
  <pre><code>string item1 = string.Empty;
  string item2 = string.Empty;
  
  ArrayList someList = new ArrayList();
  someList.Add(item1);
  someList.Add(item2);
  
  someFunc(someList);
  </code></pre>
  
  <p>Then I take someList and pass it into a method.  That method performs some manipulation on item1 and item2 and returns, as such:</p>
  
  <pre><code>public void someFunc(ArrayList parameters)
  {
      parameters[0] = "Monkeys";
      parameters[1] = "More Monkeys";
  }
  </code></pre>
  
  <p>I would expect that when someFunc returns that item1 equals "Monkeys" and item2 equals "More Monkeys" as someList contains references to item1 and item2 in indices 0 and 1 respectively.  However, what I am seeing is that item1 equals "Monkeys" and item2 equals "". </p>
  
  <p>Why?  And how would I perform this feat without passing in each item individually by ref?</p>