I've got the following public property which exposes an Arraylist
:
public ArrayList SpillageRiskDescriptions
{
get
{
return _SpillageRiskDescriptions;
}
set
{
_SpillageRiskDescriptions = value;
}
}
Elsewhere I'm calling
SpillageRiskDescriptions.Add("VENTILATE AREA");
SpillageRiskDescriptions.Add("DO NOT ALLOW SPILLAGE TO ENTER MAINS");
These seem to be adding elements to the private ArrayList _SpillageRiskDescriptions
(through the property) whereas I would've expected this to cause a problem. Therefore am I correct in thinking that properties return a reference to the original variable and not passing it by value? Is this because ArrayList
is a reference type? Will the same happen with an int
(for example?)