-
-
Notifications
You must be signed in to change notification settings - Fork 7
Use Object
apobekiaris edited this page Sep 4, 2020
·
6 revisions
Disposes a disposable object, same as c# using keyword.
Use-Object [[-InputObject] <Object>] [-ScriptBlock] <ScriptBlock> [<CommonParameters>]
Disposes a disposable object, same as c# using keyword.
PS C:\> Use-Object($c=[System.Net.WebClient]::new()){
$c.DownloadFile($_.resource.downloadUrl,$zip)
}
Use a webclient and dispose it when done.
{{ Fill InputObject Description }}
Type: Object
Parameter Sets: (All)
Aliases:
Required: False
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
{{ Fill ScriptBlock Description }}
Type: ScriptBlock
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.