Skip to content

Instantly share code, notes, and snippets.

@dmalikov
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmalikov/9356475 to your computer and use it in GitHub Desktop.
Save dmalikov/9356475 to your computer and use it in GitHub Desktop.
.GetNewClosure()
PS C:\> { param($x) { param($y) $x + $y } }.Invoke(10).Invoke(20)
20
PS C:\> { param($x) { param($y) $x + $y }.GetNewClosure() }.Invoke(10).Invoke(20)
30
PS C:\> ({ param($x) { param($y) $y * $x } }.Invoke(10).Invoke(20)) -eq 0
True
PS C:\> ({ param($x) { param($y) $x * $y } }.Invoke(10).Invoke(20)) -eq $null
True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment