S
Simon Harvey
Hi all,
When executing the following, is it a copy or a reference thats copied to
the array?
SqlCommand cmd = new SqlCommand("w", x);
myArrayList.Add(cmd); // A reference
or a copy?
The reason i ask is that I then want to go on and use the same variable name
to make a new cmd and then copy that to the array as well
eg:
SqlCommand cmd = new SqlCommand("y", z);
myArrayList.Add(cmd); // A reference
or a copy?
Is this possible? It does actually seem to work but I don't think it should.
Should I make a copy of the object before putting it in the array list
Many thanks
Simon
When executing the following, is it a copy or a reference thats copied to
the array?
SqlCommand cmd = new SqlCommand("w", x);
myArrayList.Add(cmd); // A reference
or a copy?
The reason i ask is that I then want to go on and use the same variable name
to make a new cmd and then copy that to the array as well
eg:
SqlCommand cmd = new SqlCommand("y", z);
myArrayList.Add(cmd); // A reference
or a copy?
Is this possible? It does actually seem to work but I don't think it should.
Should I make a copy of the object before putting it in the array list
Many thanks
Simon