Ho un problema in uno script PowerShell:Passando tabella hash come argomento di una funzione in PS
Quando voglio passare un Hashtable a una funzione, questa tabella hash non è riconosciuto come una tabella hash.
function getLength(){
param(
[hashtable]$input
)
$input.Length| Write-Output
}
$table = @{};
$obj = New-Object PSObject;$obj | Add-Member NoteProperty Size 2895 | Add-Member NoteProperty Count 5124587
$table["Test"] = $obj
$table.GetType() | Write-Output ` Hashtable
$tx_table = getLength $table `Unable to convert System.Collections.ArrayList+ArrayListEnumeratorSimple in System.Collections.Hashtable
Perché?
OMG. Grazie per la soluzione e i consigli. – Alsatian