The ArrayList class can only contain references to objects but what happens when you store a value type such as integers?
string str = "Hello";
int i = 50;
ArrayList arraylist = new ArrayList();
arraylist.Add(str); // Makes perfectly sense:
// Reference to string-object (instance) "Hello" is added to
// index number 0
arraylist.Add(i); // What happens here? How can a reference point to a value
// type? Is the value type automatically converted to an
// object and thereafter added to the ArrayList?
It’s called “boxing”: automagically the int is converted to a reference type. This does cost some performance.
See also Boxing and Unboxing.