Closed SteveL-MSFT closed 2 weeks ago
I will add examples to show the behavior and how to work around the behavior
function Test-Select {
[PSCustomObject]@{
"name"="admin1"
"children"=[PSCustomObject]@{
"name"="admin2"
}
}
}
$obj = Test-Select
New-Object PSObject -Property @{Country = $obj.name; Children=$obj.Children}
Prerequisites
Get-Foo
cmdlet" instead of "Typo."Links
Summary
The
Select-Object
docs do not indicate that there are cases where the input object may be modified which can be surprising to users. As the WG-Cmdlets has made a decision to NOT change this behavior as we believe it would likely break folks, we need to document this explicitly.Details
Suggested Fix
Add details to the docs on when the input object can be modified. Add example on how to get the same behavior as
ExpandProperty
by simply creating a new PSObject "manually" instead of usingSelect-Object