Re: Best way to clone an ArrayList?
- From: "cody" <deutronium@xxxxxx>
- Date: Mon, 18 Jul 2005 13:02:17 +0200
ArrayList.Clone();
"Chris Bellini" <chris-hatesspam@xxxxxxxxxxxxxxxxxxxxxxxxxxx> schrieb im
Newsbeitrag news:etOkg8UiFHA.3656@xxxxxxxxxxxxxxxxxxxxxxx
> 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
.
- References:
- Best way to clone an ArrayList?
- From: Chris Bellini
- Best way to clone an ArrayList?
- Prev by Date: Re: Pass external delegate to a class constructor.
- Next by Date: Re: Why can't C# use System.Void type?
- Previous by thread: Re: Best way to clone an ArrayList?
- Next by thread: Pass external delegate to a class constructor.
- Index(es):
Relevant Pages
|