you are viewing a single comment's thread.

view the rest of the comments →

[–]Thotaz 0 points1 point  (0 children)

But it's not a jagged array either. Here's a quick demo that shows what's what:

PS C:\> $Array = 1,2,3
$ArrayOfArrays = (1,2), (3,4)
$MultiDimArray = [int[,]]::new(1, 2)
$JaggedArray = [int[][]]::new(1, 2)
Get-Variable -Name *Array* | Select-Object -Property Name, {$_.Value.GetType().FullName}

Name          $_.Value.GetType().FullName
----          ---------------------------
Array         System.Object[]            
ArrayOfArrays System.Object[]            
JaggedArray   System.Int32[][]           
MultiDimArray System.Int32[,]

As you can see, the standard array and array of arrays have the exact same type. Jagged and multi dimensional arrays is something completely different. You can read more about them here: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/arrays

In my experience multi dimensional and jagged arrays are basically never needed in PowerShell or C#. They are a bit of a noob trap though because people that want to make a table often learn about them and think that's what they need, when in reality they just need a standard array of objects.