Create data.txt via Notepad containing three lines:
ABCZ
ABC_
ABCA
Saved as ANSI.
Get-Content -Encoding Byte data.txt 65 66 67 90 13 10 65 66 67 95 13 10 65 66 67 65 13 10 $a = Get-Content data.txt $b = @( 'ABCZ', 'ABC_', 'ABCA' ) $a[0] -eq $b[0]; $a[1] -eq $b[1]; $a[2] -eq $b[2]; True True True [System.Collections.ArrayList] $al = $a [System.Collections.ArrayList] $bl = $b $al[0] -eq $bl[0]; $al[1] -eq $bl[1]; $al[2] -eq $bl[2]; True True True $al.Sort( [System.StringComparer]::Ordinal ) $bl.Sort( [System.StringComparer]::Ordinal ) $al ABC_ ABCA ABCZ $bl ABCA ABCZ ABC_Why do the two ArrayLists sort differently?