Last active
May 19, 2016 15:54
-
-
Save advanceboy/1d17743e7c75b76d539a35ae91680489 to your computer and use it in GitHub Desktop.
PowerShell の hashtable (System.Collections.Hashtable) と @{} の シリアライズ時 の挙動の違い。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$a = @{} | |
$b = New-Object hashtable | |
$a['a'] = 1 | |
$a['A'] = 2 | |
$b['a'] = 1 | |
$b['A'] = 2 | |
$a | |
# Name Value | |
# ---- ----- | |
# a 2 | |
$b | |
# Name Value | |
# ---- ----- | |
# A 2 | |
# a 1 | |
$a | Export-Clixml "$env:TEMP\t.xml" | |
$c = Import-Clixml "$env:TEMP\t.xml" | |
$b | Export-Clixml "$env:TEMP\t.xml" | |
$d = Import-Clixml "$env:TEMP\t.xml" | |
$c['b'] = 3 | |
$c['B'] = 4 | |
$d['b'] = 3 | |
$d['B'] = 4 | |
$c | |
# On PowerShell v2 | |
# Name Value | |
# ---- ----- | |
# b 3 | |
# B 4 | |
# a 2 | |
# | |
# On PowerShell v4 | |
# Name Value | |
# ---- ----- | |
# a 2 | |
# b 4 | |
$d | |
# On PowerShell v2 | |
# Name Value | |
# ---- ----- | |
# b 3 | |
# B 4 | |
# a 1 | |
# A 2 | |
# | |
# On PowerShell v4 | |
# Name Value | |
# ---- ----- | |
# A 2 | |
# b 3 | |
# a 1 | |
# B 4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment