I’m using Windows 7 and PowerGUI Script Editor to write a ps1.
Here’s a part of my codes:
#In global scope
$Type_Trans = "System.Collections.Generic.Dictionary[System.String,PSObject]"
$Type_Farms = "System.Collections.Generic.Dictionary[System.Int32,$Type_Trans]"
$Dic_Counts = New-Object $Type_Farms
#...puts some data in $Dic_Counts here...
#It is no problem with printing out it in console
#Now call the function below
Write-Data $Dic_Counts
Function Write-Data
{
param(
$Dic_Counts
)
Foreach($Dic_CountsSingle in $Dic_Counts)
{
Write-DataSingle $Dic_CountsSingle #THIS LINE!
}
}
It’s very strange here: why is Dic_CountsSingle not a KeyValuePair, but is just the same as Dic_Counts??
Thank you very much!
Use
It’s the same for hashtables in PowerShell, too, so not particularly surprising.