Skip to content

Instantly share code, notes, and snippets.

@stknohg
Created August 23, 2019 08:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stknohg/f9cafcf77f9fb50ae423ba0d63c1ad8f to your computer and use it in GitHub Desktop.
Save stknohg/f9cafcf77f9fb50ae423ba0d63c1ad8f to your computer and use it in GitHub Desktop.
$nullとAuotmationNullの違い的な奴
$null | % {$i=0} {"$i : $_";$i++}
[System.Management.Automation.Internal.AutomationNull]::Value | % {$i=0} {"$i : $_";$i++}
@("a", $null, "c") | % {$i=0} {"$i : $_";$i++}
@("a", [System.Management.Automation.Internal.AutomationNull]::Value, "c") | % {$i=0} {"$i : $_";$i++}
@stknohg
Copy link
Author

stknohg commented Aug 23, 2019

結果

C:\> $null | % {$i=0} {"$i : $_";$i++}                                                                                  
0 :
C:\> [System.Management.Automation.Internal.AutomationNull]::Value | % {$i=0} {"$i : $_";$i++}                          
C:\> @("a", $null, "c") | % {$i=0} {"$i : $_";$i++}                                                                     
0 : a
1 :
2 : c
C:\> @("a", [System.Management.Automation.Internal.AutomationNull]::Value, "c") | % {$i=0} {"$i : $_";$i++}             
0 : a
1 : c
C:\> 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment