Functions/array.ps1
function Merge-Array( [object[]]$array, [Parameter(Mandatory = $true)] [object[]]$arrayToMerge ) { if ($array -ceq $null) { return $arrayToMerge } $filteredList = @() foreach ($property in $array) { $filteredList += $property.PSObject.properties.name } foreach ($item in ($arrayToMerge | Where-Object {($_.PSObject.Properties.Name -CNotIn $filteredList )})) { $array += $item } return $array } |