You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to understand why the following two statements yield different outputs:
&{,$null} |% {'x'} # x&{,(1)[1]} |% {'x'} # no output
,$null and ,(1)[1] both seem to be arrays containing a single null element. Yet they behave differently during output from a scriptblock. What is happening here?
alx9r: This comes down to the question you later asked in #6436 and which I've brought into focus in #6436 (comment), but I've decided to create a separate issue for it: #6823
Activity
powercode commentedon Mar 10, 2018
The second returns
AutomationNull.Valuewhich is not enumerated by the pipeline.$nullis enumerated.See for example the implementation of foreach:
PowerShell/src/System.Management.Automation/engine/runtime/Operations/MiscOps.cs
Line 2748 in bcf86d4
alx9r commentedon Mar 10, 2018
Thank you Staffan Gustafsson (@powercode). For other readers, here are some resources on
AutomationNull:mklement0 commentedon May 5, 2018
alx9r: This comes down to the question you later asked in #6436 and which I've brought into focus in #6436 (comment), but I've decided to create a separate issue for it: #6823