Another possibility is to use a more compact foreach form:
$Out = @{} Import-Csv Table.csv | %{ $Out[$_.Key] = $_.Value }
which leaves $ Out set for the hash table of values, rather than converting the pipeline to create the hash table. But you, of course, can pass $ Out to something else.
Also note that there is a subtle difference between $ Out.Add (x, y) and $ Out [x] = y. The former throws an exception if the element is already present, and the latter replaces it.
source share