Created
August 29, 2015 23:03
-
-
Save guitarrapc/0ebd8c1c54aabc7e610c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function using | |
{ | |
param($obj, [scriptblock]$sb) | |
try { | |
& $sb | |
} finally { | |
if ($obj -is [IDisposable]) { | |
$obj.Dispose() | |
} | |
} | |
} | |
using ($stream = new-object System.IO.StreamReader $PSHOME\types.ps1xml) { | |
foreach ($_ in 1..5) { $stream.ReadLine() } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment