From 9a4da35a8da15bc4104cfe0f442435fd57a1b627 Mon Sep 17 00:00:00 2001 From: tommymaynard Date: Fri, 20 May 2022 09:28:22 -0700 Subject: [PATCH] Remove example #5, renumbered. --- .../Add-Member.md | 24 +------------------ .../Add-Member.md | 24 +------------------ .../Add-Member.md | 24 +------------------ .../Add-Member.md | 24 +------------------ 4 files changed, 4 insertions(+), 92 deletions(-) diff --git a/reference/5.1/Microsoft.PowerShell.Utility/Add-Member.md b/reference/5.1/Microsoft.PowerShell.Utility/Add-Member.md index 54c49cfc10be..42cbd71fd29e 100644 --- a/reference/5.1/Microsoft.PowerShell.Utility/Add-Member.md +++ b/reference/5.1/Microsoft.PowerShell.Utility/Add-Member.md @@ -160,29 +160,7 @@ $A.SizeInMB() 0.43 ``` -### Example 5: Copy all properties of an object to another - -This function copies all of the properties of one object to another object. - -The `foreach` loop uses the `Get-Member` cmdlet to get each of the properties of the **From** -object. The commands within the `foreach` loop are performed in series on each of the properties. - -The `Add-Member` command adds the property of the **From** object to the **To** object as a -**NoteProperty**. The value is copied using the **Value** parameter. It uses the **Force** parameter -to add members with the same member name. - -```powershell -function Copy-Property ($From, $To) -{ - $properties = Get-Member -InputObject $From -MemberType Property - foreach ($p in $properties) - { - $To | Add-Member -MemberType NoteProperty -Name $p.Name -Value $From.$($p.Name) -Force - } -} -``` - -### Example 6: Create a custom object +### Example 5: Create a custom object This example creates an **Asset** custom object. diff --git a/reference/7.0/Microsoft.PowerShell.Utility/Add-Member.md b/reference/7.0/Microsoft.PowerShell.Utility/Add-Member.md index 15aa4ff96b9e..7995c6b3edbf 100644 --- a/reference/7.0/Microsoft.PowerShell.Utility/Add-Member.md +++ b/reference/7.0/Microsoft.PowerShell.Utility/Add-Member.md @@ -160,29 +160,7 @@ $A.SizeInMB() 0.43 ``` -### Example 5: Copy all properties of an object to another - -This function copies all of the properties of one object to another object. - -The `foreach` loop uses the `Get-Member` cmdlet to get each of the properties of the **From** -object. The commands within the `foreach` loop are performed in series on each of the properties. - -The `Add-Member` command adds the property of the **From** object to the **To** object as a -**NoteProperty**. The value is copied using the **Value** parameter. It uses the **Force** parameter -to add members with the same member name. - -```powershell -function Copy-Property ($From, $To) -{ - $properties = Get-Member -InputObject $From -MemberType Property - foreach ($p in $properties) - { - $To | Add-Member -MemberType NoteProperty -Name $p.Name -Value $From.$($p.Name) -Force - } -} -``` - -### Example 6: Create a custom object +### Example 5: Create a custom object This example creates an **Asset** custom object. diff --git a/reference/7.2/Microsoft.PowerShell.Utility/Add-Member.md b/reference/7.2/Microsoft.PowerShell.Utility/Add-Member.md index 871d1e583691..5ef9cd1de344 100644 --- a/reference/7.2/Microsoft.PowerShell.Utility/Add-Member.md +++ b/reference/7.2/Microsoft.PowerShell.Utility/Add-Member.md @@ -160,29 +160,7 @@ $A.SizeInMB() 0.43 ``` -### Example 5: Copy all properties of an object to another - -This function copies all of the properties of one object to another object. - -The `foreach` loop uses the `Get-Member` cmdlet to get each of the properties of the **From** -object. The commands within the `foreach` loop are performed in series on each of the properties. - -The `Add-Member` command adds the property of the **From** object to the **To** object as a -**NoteProperty**. The value is copied using the **Value** parameter. It uses the **Force** parameter -to add members with the same member name. - -```powershell -function Copy-Property ($From, $To) -{ - $properties = Get-Member -InputObject $From -MemberType Property - foreach ($p in $properties) - { - $To | Add-Member -MemberType NoteProperty -Name $p.Name -Value $From.$($p.Name) -Force - } -} -``` - -### Example 6: Create a custom object +### Example 5: Create a custom object This example creates an **Asset** custom object. diff --git a/reference/7.3/Microsoft.PowerShell.Utility/Add-Member.md b/reference/7.3/Microsoft.PowerShell.Utility/Add-Member.md index bd391555c686..594c74118190 100644 --- a/reference/7.3/Microsoft.PowerShell.Utility/Add-Member.md +++ b/reference/7.3/Microsoft.PowerShell.Utility/Add-Member.md @@ -160,29 +160,7 @@ $A.SizeInMB() 0.43 ``` -### Example 5: Copy all properties of an object to another - -This function copies all of the properties of one object to another object. - -The `foreach` loop uses the `Get-Member` cmdlet to get each of the properties of the **From** -object. The commands within the `foreach` loop are performed in series on each of the properties. - -The `Add-Member` command adds the property of the **From** object to the **To** object as a -**NoteProperty**. The value is copied using the **Value** parameter. It uses the **Force** parameter -to add members with the same member name. - -```powershell -function Copy-Property ($From, $To) -{ - $properties = Get-Member -InputObject $From -MemberType Property - foreach ($p in $properties) - { - $To | Add-Member -MemberType NoteProperty -Name $p.Name -Value $From.$($p.Name) -Force - } -} -``` - -### Example 6: Create a custom object +### Example 5: Create a custom object This example creates an **Asset** custom object.