For this specific example, you can easily get what you want by sticking them in the property of an object. For the sake of an example, lets create an array with your three tests in it:
$tests = @($null,@(), @($null,$null))
function Write-Visible {
param($InputObject)
New-Object PSObject -Property @{ Object=$InputObject } |
Out-String | Out-Host
}
Of course, the Out-String | Out-Host
stuff is just to make sure we don't actually output the objects to the pipeline, but behave like Write-Host does.
So now we can run our tests:
PS> Write-Visible $tests[0]
Object
------
PS> Write-Visible $tests[1]
Object
------
{}
PS> Write-Visible $tests[2]
Object
------
{$null, $null}
Of course, the problem with that is that it tends not to work so great for real objects because it's turning them into properties of an object, where they get rendered "ToString()" ... however, off the top of my head, I can't think how to invoke the rendering magic that happens there without the new object.