Y
ycsx
Unregistered / Unconfirmed
GUEST, unregistred user!
请看这样一段代码:
TSubArray = record
Item1 : string;
Item2 : string;
end;
TMyArray = record
Items : Array of TSubArray;
end;
....
var
myArray : Array of TMyArray;
begin
SetLength(myArray,2);
SetLength(myArray[0].SubArray,2);
SetLength(myArray[1].SubArray,3);
myArray[0].SubArray[0] := 'abc';
.....
SetLength(myArray,0);
end
问题是:有没有必要加这样的代码:
SetLength(myArray[0].SubArray,0);
SetLength(myArray[1].SubArray,0);
.....
TSubArray = record
Item1 : string;
Item2 : string;
end;
TMyArray = record
Items : Array of TSubArray;
end;
....
var
myArray : Array of TMyArray;
begin
SetLength(myArray,2);
SetLength(myArray[0].SubArray,2);
SetLength(myArray[1].SubArray,3);
myArray[0].SubArray[0] := 'abc';
.....
SetLength(myArray,0);
end
问题是:有没有必要加这样的代码:
SetLength(myArray[0].SubArray,0);
SetLength(myArray[1].SubArray,0);
.....