There are multiple ways to copy an arraycollection ..
1. ac1 = ac2;
2. ac1 = new ArrayCollection (ac2.source);
3. ac1 = ObjectUtil.copy (ac2) as ArrayCollection;
Method 1 copy the ac by reference.
Method 2 will create an new ac instance, but the value (array) inside two ac are still the same.
Method 3 will create completely two different objects.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment