Sharp compared

In C#, if you want a case-insensitive comparison of two strings, use String.Compare(), rather then applying ToLower() to the strings. Remember that the String class is immutable and “modification” methods actually create a new string and copy in memory. (Actually, I don’t know how this works in Java).

Bonus question to the audience: Does anyone know if the String.Length property can be accessed with O(1)?


Comments are closed.

Create a free website or blog at

Up ↑

%d bloggers like this: