Initialize dictionary at declaration using PowerShell
No. The initialization syntax for Dictionary<TKey,TValue> is C# syntax candy. Powershell has its own initializer syntax support for System.Collections.HashTable (@{}): $drivers = @{“nitrous”=”vx”; “directx”=”vd”; “openGL”=”vo”}; For [probably] nearly all cases it will work just as well as Dictionary<TKey,TValue>. If you really need Dictionary<TKey,TValue> for some reason, you could make a function that takes a HashTable … Read more