Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Dictionary in script?

$
0
0

Hi developer,
I am having problem with Add method. Here is my sample script:

...........................
...........................
$dictionary = @()
foreach($aa in $test)
{

   foreach(.....)
   {
       ...........................
       ...........................

       $firstValue = $value[0]
       $SecondValue = $value[1]

       $dictionary.Add($firstValue,$SecondValue)

   }
}

I got error message and it says:

"Method invocation failed because [System.Object[]] doesn't contain a method named 'Add'.
At line:28 char:28
    + $dictionary.Add <<<< ($firstValue,$SecondValue)
    + CategoryInfo          : InvalidOperation: (Add:String) [], RuntimeException
    + FullyQualifiedErrorId : MethodNotFound"


Any Idea?
Thanks



Viewing all articles
Browse latest Browse all 21975


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>