-
Notifications
You must be signed in to change notification settings - Fork 1.7k
the copy-property function in example 6 is incorrect #4220
Copy link
Copy link
Closed
Labels
area-utilityArea - Microsoft.PowerShell.Utility moduleArea - Microsoft.PowerShell.Utility module
Description
In the example, the add-member command is broken into two lines before -Value. And then the assignment statement "$To.$($p.Name) =
function Copy-Property ($From, $To)
{
foreach ($p in Get-Member -InputObject $From -MemberType Property,NoteProperty)
{
Add-Member -InputObject $To -MemberType NoteProperty -Name $p.Name -Value $From.$($p.Name)
}
}Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 92e17fc3-bf10-f09d-8102-da5fe518838b
- Version Independent ID: 6441c722-b93a-1746-e38a-29a6722fc0a3
- Content: Add-Member (Microsoft.PowerShell.Utility)
- Content Source: reference/6/Microsoft.PowerShell.Utility/Add-Member.md
- Product: powershell
- Technology: powershell-cmdlets
- GitHub Login: @JamesWTruher
- Microsoft Alias: jimtru
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-utilityArea - Microsoft.PowerShell.Utility moduleArea - Microsoft.PowerShell.Utility module