Я использую редактор сценариев Windows 7 и PowerGUI для написания ps1. Вот часть моих кодов:неверный цикл foreach для сложного словаря
#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!
}
}
Это очень странно здесь: почему Dic_CountsSingle
не KeyValuePair
, но так же, как Dic_Counts
??
спасибо!
вы можете объяснить, почему это? –