Skip to content

Instantly share code, notes, and snippets.

@sean-m
Created June 22, 2020 23:43
Show Gist options
  • Save sean-m/02ab04b055b527ae26fcdeb936b96c5a to your computer and use it in GitHub Desktop.
Save sean-m/02ab04b055b527ae26fcdeb936b96c5a to your computer and use it in GitHub Desktop.
helper for using Linq zip in powershell, short enough to write manually but easier to paste one that already behaves.
function Zip {
param ([object[]]$first, [object[]]$second)
[Func[object,object,object]]$zipper = { param ($a, $b) New-Object PSObject -Property @{First=$a;Second=$b} }
[System.Linq.Enumerable]::Zip($first, $second, $zipper)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment