I was just looking for some opinions on the best way to clone an
ArrayList object. For example, if class A contains an ArrayList, what
would be the best way to make a copy of it for class B (but not using
the class constructors):
class A
{
public A()
{
// constructor stuff goes here
}
public void DoStuff()
{
ArrayList arrTPB = new ArrayList();
arrTPB.Add("Ricky");
arrTPB.Add("Julian");
arrTPB.Add("Bubbles");
// new B object
B myB = new B();
// copy arrTPB from class A to arrNames of myB
// ???
}
}
class B
{
public ArrayList arrNames;
public B()
{
arrNames = new ArrayList();
// other constructor stuff goes here
}
}
Thanks in advance.
Chris