tojo2000
2008-09-01 10:17:29 UTC
There are two cases in which it seems like PowerShell's treatment of
strings as case-insensitive could cause problems. The first is the
"string1 -eq string2" case where you want to compare two strings and
find out if they are really the same. (Yes, I know you can use
CompareTo, but -eq seems more....PowerShelly.
The second thing is when it comes to hashtable keys. A lot of the use
cases for hashtables rely on assigning a key for a unique string. The
PowerShell implementation of a hashtable uses case-insensitive keys,
which can occasionally cause issues.
The second issue is more important than the first because there
doesn't appear to be any workaround, so my most important question is
this:
Is there a .NET object that implements IDictionary that uses case-
insensitive keys? Alternatively, is there another workaround?
strings as case-insensitive could cause problems. The first is the
"string1 -eq string2" case where you want to compare two strings and
find out if they are really the same. (Yes, I know you can use
CompareTo, but -eq seems more....PowerShelly.
The second thing is when it comes to hashtable keys. A lot of the use
cases for hashtables rely on assigning a key for a unique string. The
PowerShell implementation of a hashtable uses case-insensitive keys,
which can occasionally cause issues.
The second issue is more important than the first because there
doesn't appear to be any workaround, so my most important question is
this:
Is there a .NET object that implements IDictionary that uses case-
insensitive keys? Alternatively, is there another workaround?