1
我是否需要處理從此函數返回的對象?我在PSObject上看不到Dispose方法,但這並不一定意味着該對象不能/不應該被丟棄。我搜索了谷歌,並找不到與處置PSObject對象相關的任何內容。我該如何處理自定義PSObjects?
function MakeDBConnectInfoObject(
[string] $DBDestServer,
[string] $DBDestDB,
[string] $DBDestUserName,
[string] $DBDestPassword
) {
$DBConnectInfo = new-object -typename psobject -property @{
DBDestServer = $DBDestServer
DBDestDB = $DBDestDB
DBDestUserName = $DBDestUserName
DBDestPassword = $DBDestPassword
}
return $DBConnectInfo
}