Thursday November 26th

Wednesday November 25th

1 Kicks

When PowerShell hash table magic backfires

We just made it through the holidays and I finally found time to write about the most annoying thing in PowerShell: Hash table semi-automatic, which can easily result in some subtle bugs. And all of that, just because the hash tables don't behave as I would expect. I assumed hash tables to be implicitly sorted by the keys using the Sort-Object cmdlet and to always stay hash tables and not get converted into arrays of Dictionary Entries or even a single Dictionary entry when piped into a Where-Object cmdlet. To workaround these strange defects you need to apply some unnatural constructs and roll your own select statements. It just doesn't feel fair to make your children call GetEnumerator() before they try to find today's window on their Advents Calendar.


Commenting on Stories is limited for now and will open up to those recommended by the community. Learn how
Loading DotNetKicks...
brought to you by the Kicks Network