I'm trying to partition out chunks of work using PowerShell (5.0) and am having a hard time instantiating a multidimensional array.
$n = 456;
$MaxChunks = 6;
$Chunks = @();
for($x = 0; $x -lt $MaxChunks; $x++)
{
Write-Host "Creating chunk $x"
$Chunks += @();
}
$Chunks.Count
always returns 0 and I cannot access anything in $Chunks by index (i.e. $Chunks[0]
is null).
Ultimately, my goal is to access the array located at $Chunks[$i]
and add multiple System.Data.DataRow
objects to it. However, as I've said, I'm not able to access the array at that index because that array is never instantiated.
I've read through this and this but am not quite able to translate the hashtable scenario to my situation.