Created
December 12, 2010 01:06
-
-
Save NeilRobbins/737762 to your computer and use it in GitHub Desktop.
Changing the number of arrays held in an array seems to change the way in which it behaves when parsed. Given an array which contains 1 item which is an array containing a single string item: $buzz = @(@("FooBar"))
When the first item is requested: $b
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cls | |
&{ | |
$buzz = @(@("FooBar")) | |
Write-Host ("Length of parent array is: {0}" -f $buzz.Length) | |
Write-Host ("Type of parent array is: {0}" -f $buzz.GetType()) | |
Write-Host ("Length of child array is: {0}" -f $buzz[0].Length) | |
Write-Host ("Type of child array is: {0}" -f $buzz[0].GetType()) | |
} | |
Write-Host "" | |
&{ | |
$buzz = @(@("FooBar"), @("BarFoo")) | |
Write-Host ("Length of parent array is: {0}" -f $buzz.Length) | |
Write-Host ("Type of parent array is: {0}" -f $buzz.GetType()) | |
Write-Host ("Length of child array is: {0}" -f $buzz[0].Length) | |
Write-Host ("Type of child array is: {0}" -f $buzz[0].GetType()) | |
} | |
#Length of parent array is: 1 | |
#Type of parent array is: System.Object[] | |
#Length of child array is: 6 | |
#Type of child array is: System.String | |
# | |
#Length of parent array is: 2 | |
#Type of parent array is: System.Object[] | |
#Length of child array is: 1 | |
#Type of child array is: System.Object[] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment