PS C:\> $Null |Join $Employee |Ft
Id Name Country Department Age ReportsTo
-- ---- ------- ---------- --- ---------
{1, 1} {Aerts, Aerts} {Belgium, Belgium} {Sales, Sales} {40, 40} {5, 5}
{2, 2} {Bauer, Bauer} {Germany, Germany} {Engineering, Engineering} {31, 31} {4, 4}
{3, 3} {Cook, Cook} {England, England} {Sales, Sales} {69, 69} {1, 1}
{4, 4} {Duval, Duval} {France, France} {Engineering, Engineering} {21, 21} {5, 5}
{5, 5} {Evans, Evans} {England, England} {Marketing, Marketing} {35, 35} {, }
{6, 6} {Fischer, Fischer} {Germany, Germany} {Engineering, Engineering} {29, 29} {4, 4}
PS C:\> @() |Join $Employee |Ft
Id Name Country Department Age ReportsTo
-- ---- ------- ---------- --- ---------
{1, 1} {Aerts, Aerts} {Belgium, Belgium} {Sales, Sales} {40, 40} {5, 5}
{2, 2} {Bauer, Bauer} {Germany, Germany} {Engineering, Engineering} {31, 31} {4, 4}
{3, 3} {Cook, Cook} {England, England} {Sales, Sales} {69, 69} {1, 1}
{4, 4} {Duval, Duval} {France, France} {Engineering, Engineering} {21, 21} {5, 5}
{5, 5} {Evans, Evans} {England, England} {Marketing, Marketing} {35, 35} {, }
{6, 6} {Fischer, Fischer} {Germany, Germany} {Engineering, Engineering} {29, 29} {4, 4}
PS C:\> $Employee |Join $Null |Ft
InvalidOperation: C:\Join.ps1:345
Line |
345 | … in $Keys) { $Properties.Add($Key, $Object.psobject.properties[$Key].V …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Cannot index into a null array.
Id Name Country Department Age ReportsTo
-- ---- ------- ---------- --- ---------
1 Aerts Belgium Sales 40 5
PS C:\> $Employee |Join @() |Ft
InvalidOperation: C:\Join.ps1:454
Line |
454 | ([ref]$RightKeys).Value = $Right.get_Keys()
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| You cannot call a method on a null-valued expression.
MethodInvocationException: C:\Join.ps1:371
Line |
371 | if (!$Expressions.Contains($Key)) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Exception calling "Contains" with "1" argument(s): "Value cannot be null. (Parameter 'key')"
Considered how to deal with
$Nulland empty array inputs:@() |Join $ObjectThis situation could potentially occur from a chained (inner) join.
But at the other hand, could useful as initial "object" in an loop:
... |% { $a = $Null } { $a = $a |Join $_ }$Object |Join $Nullor$Object |Join @()Current situation: