'How do I insert strings into an array of an array? [duplicate]

I am trying to insert strings into an array of an array but it's not working. Here is what I'm trying to do:

[string[]] $workArray::new(6,2)

$workArray[0,1] = "C:\Users\"
$workArray[0,2] = "Document.xlsm"

However I'm getting this error: "Unable to index into an object of type System.String."

Any suggestions I'll be forever grateful!



Solution 1:[1]

$workArray = [string[,]]::new(6, 2)
$workArray[0,0] = "C:\Users\"
$workArray[0,1] = "Document.xlsm"

PowerShell is zero indexed.

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_arrays?view=powershell-7.2

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 another victim of the mouse