PowerShell - After recommedation of array - hash table use

Hi

I am struggling a bit trying to work out the best way to dynamically store some info then access it.

(Note: I read the data in so can't statically initialise the array, some .Add() is needed) 

I have two classed of data with variable columns count

Type A
Name, Token1, token2, ... repeating

Type B
NameX, Info1, Info2, TokenA, TokenB, ...

What I would like to do is :
- Add a row of Type A data to the Type A array with a key of "Name"
- Add a row of Type B data to the Type B array with a key of "NameX"

Then access the respective arrays with the appropriate Name key and get the "object" which has the data

Then from the data get the various tokens and info. This can be by $x[0], $x[1] type of references but would be nice if
I could do $x["Info1"], $x["info2"]   and   foreach $x["token*"]  <= i.e. each token

>> After some tips ?

(seems like I need a hash table to an array but I can't seem to get this right)

I hope I have explained this clearly enough.

Thanks in advance


September 1st, 2015 3:16am

HELP import-csv -full

Free Windows Admin Tool Kit Click here and download it now
September 1st, 2015 4:23am

Thanks

This is a simple alternative to the path I was following

regards

September 1st, 2015 7:39am

Yes - arrays are not really that useful.  Objects are much better.
Free Windows Admin Tool Kit Click here and download it now
September 1st, 2015 8:03am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics