At the time of this posting, Irony.CharHashSet.Add performs the following logic
Where it would probably be more efficient to perform the the same logic as such:
Where we're using the System.Char class methods to perform the invariant casing instead of needlessly allocating a new string and using the string's implementation of ToCASE which itself may allocate a new string for the result.
It's a "possible inefficiency" because I haven't done any performance tests to back it up. The actual implementation for char and string's ToCASE methods lead to external implementations, so I can't gauge how inefficient one is over the other. Best
case scenario, you nix 2*2 needless string allocations and execute in fewer cycles (if you're into counting pennies). Worst case scenario, the ultimate (and framework dependent) ToCASE implementation is optimized for strings. But one would think the string
implementation uses the char implementation for each char in the actual string.
On the topic of utilities, isn't it kind of silly to use a try/catch block like you do in Irony.StringList.LongerFirst, instead of actually checking for null?
if(x != null && y != null &&
x.Length > y.Length)