Your code will simply not do what you expect. Your variables item1 and item2 will not be modified by reassigning to the list. You cannot add a reference to a variable to an ArrayList (or preferably a List<T> in the modern .NET world). You can simply add the value itself (which could be a reference to an object). When you overwrite the value that was originally stored in the list, it does not impact the previous variable.
If you need updates inside the list to reflect on outer variables, you may need a different abstraction. You make your variables properties of a class, for example, and then maintain a list of that class. And instead of overwriting the contents of your list, you could then mutate the class by changing the property. This technique is demonstrated in Niyoko Yuliawan's answer, so I will not redisplay it.
Another technique mentioned is to read the values back into your variables. If the list has the same number of values in the same order, this is doable. However, I should note that if you are adding multiple values to a list, passing them into a method, changing the values in the list, and then rereading those values into your variables, you probably did not need a list, you needed a class. If item1 and item2 are really firstName and lastName, for example, you don't want ArrayList list (or, again, preferably List<string> list), you really want Person person that has string FirstName and string LastName properties.
So if you had
public void SomeFunc(ArrayList list)
{
list[0] = "Sam";
list[1] = "Smith";
}
You probably should consider instead defining a class and then working with that class.
public class Person
{
public string FirstName { get; set; }
public string LastName { get; set; }
}
// elsewhere in your code...
public void SomeFunc(Person person)
{
person.FirstName = "Sam";
person.LastName = "Smith";
}
item1anditem2after your call tosomeFuncshould both still be empty strings. YoursomeList[0]andsomeList[1]should beMonkeysandMore Monkeysrespectively. If you're seeing anything other than that, then there is something you are not telling us.someListis changed (both values),item1anditem2not. All as expected.