concept multidimensional array in category powershell

appears as: multidimensional arrays, multidimensional array
Windows PowerShell in Action, Third Edition

This is an excerpt from Manning's book Windows PowerShell in Action, Third Edition.

Now that you understand what a jagged array is, we’ll move on to multidimensional arrays. PowerShell needs to support multidimensional arrays because .NET allows for arrays to be multidimensional and PowerShell is built on top of .NET. Figure 4.10 shows a two-dimensional array.

Figure 4.10. A two-dimensional 6 x 4 array of numbers

As shown in figure 4.10, PowerShell indexes into multidimensional arrays by looking at the type of the array and mapping the set of indexes onto the number of dimensions, or rank, the array has. If you specify two indexes and the array is one-dimensional, you’ll get two elements back. If the array is two-dimensional, you’ll get one element back. Let’s try this.

Construct a multidimensional array using the New-Object cmdlet:

sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest