Discussion:
Complex Data Structures
(too old to reply)
r***@gmail.com
2007-12-03 18:34:15 UTC
Permalink
I've been looking for a little while today but I haven't been able to
find any documentation on complex data structures with Powershell.
What I'm wondering is, can you create arrays nested in associative
arrays which are also nested in associative arrays, etc? Or is there a
more Powershellish way to store nested data?
Kiron
2007-12-03 20:09:40 UTC
Permalink
Excuse the typo. Last line should be:
$collection2[1].co
r***@gmail.com
2007-12-03 20:47:56 UTC
Permalink
Thanks for the response, but I don't see message prior to this.
$collection2[1].collection1[0].OddNumbers[3]
--
Kiron
Oisin Grehan
2007-12-04 01:24:05 UTC
Permalink
Post by r***@gmail.com
Thanks for the response, but I don't see message prior to this.
$collection2[1].collection1[0].OddNumbers[3]
--
Kiron- Hide quoted text -
- Show quoted text -
I don't see Kiron's first post either? (using google groups here), but
I'm sure it was something like this:

Yes, you can. ;-)

Nested arrays:

ps> $arr = @(1,(1,2,3))
ps> $arr.length
2
ps> $arr[1].length
3

Nested hashtables:

ps> $hash = @{ foo = @{ bar = "test"; foo2 = "test2" }}
ps> $hash.keys
foo
ps> $hash["foo"].keys
bar
foo2

Hope this helps,

- Oisin / x0n

Continue reading on narkive:
Loading...