Losing array in class after Array.ToBuiltin?

Hi. Got a problem.

I’ve got this code (troll is a type of tank if anyone asks):

class Indinces {
	
	var i = new Array ();
	
	function Indinces (things : GameObject[], startIn : Array) {
		
		if (things.Length > 0) {
			for (thing in things) {
				var thingVar = Diggers (thing);
				i.Push (thingVar);
			}
			
			for (t = 0; t < i.length; t++) {
				for (sv in startIn) {
					i[t].v.Add (sv);
				}
			}
		
		}
	}

}
			
			
class Diggers {

	var o : GameObject;
	var v = new Array ();
	var e = new Array ();
	
	function Diggers (oo : GameObject) {
		
		o = oo;
	}

}

function Update () {
	
	tanks = GameObject.FindGameObjectsWithTag ("Tank");
	trollRockets = GameObject.FindGameObjectsWithTag ("RocketTroll");
	
	var indinces = new Array (); //contains ints
	
	var iTanks = Indinces (tanks, indinces);

	var iRockets = Indinces (trollRockets, indinces);

    for (/*stuff*/) {

		var iTanks2 : Diggers[] = iTanks.i.ToBuiltin (Diggers) as Diggers[];

		for (tankClear in iTanks.i) {	
			tankClear.v.Clear ();
		}
		
		var iRockets2 : Diggers[] = iRockets.i.ToBuiltin (Diggers) as Diggers[];

		for (rocketClear in iRockets.i) {	
			rocketClear.v.Clear ();
		}

            //this is where problems start*

*after this, the “o” object is still there, but the “v” array is empty. Maybe a chance that it was lost while Array.ToBuiltin ()?

Thanks for reading this far.

EDIT: Same problem with Generic Lists.

Converting to builtin array does not mean the array elements are cloned - they are still the same objects. So first element in iTanks.i javascript Array is exactly the same element as first element of iTanks2 .NET array.

You can’t then call v.Clear() on each element of both javascript arrays, and expect that it won’t affect elements of newly created builtin arrays.

EDIT: you can check that by examining v.length after calling ToBuiltin but before Clear calls.