Copy object graph
Copy-ObjectGraph
-InputObject <Object>
[-ListAs <Object>]
[-MapAs <Object>]
[-ExcludeLeafs]
[-MaxDepth <Int32> = [PSNode]::DefaultMaxDepth]
[<CommonParameters>]
Recursively ("deep") copies a object graph.
$NewObjectGraph = Copy-ObjectGraph $ObjectGraph
$PSObject = Copy-ObjectGraph $Object -ListAs [Array] -DictionaryAs PSCustomObject
$PSObject = $Json | ConvertFrom-Json | Copy-ObjectGraph -DictionaryAs ([Ordered]@{})
The input object that will be recursively copied.
Type: | Object |
Mandatory: | True |
Position: | Named |
Default value: | |
Accept pipeline input: | False |
Accept wildcard characters: | False |
If supplied, lists will be converted to the given type (or type of the supplied object example).
Type: | Object |
Mandatory: | False |
Position: | Named |
Default value: | |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Type: | Object |
Mandatory: | False |
Position: | Named |
Default value: | |
Accept pipeline input: | False |
Accept wildcard characters: | False |
If supplied, only the structure (lists, dictionaries, PSCustomObject
types and Component
types will be copied.
If omitted, each leaf will be shallow copied
Type: | SwitchParameter |
Mandatory: | False |
Position: | Named |
Default value: | |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Type: | Int32 |
Mandatory: | False |
Position: | Named |
Default value: | [PSNode]::DefaultMaxDepth |
Accept pipeline input: | False |
Accept wildcard characters: | False |