I’m looking for a simple collection that will store a bunch of strings in a case insensitive way. I need at least a Contains() and Remove() method to see if a certain string is present and to remove that string.
I’ve tried List<string> but that one is case sensitive. I need could use a case insensitive Dictionary<TKey, T>, but that “feels” like a waste of space. Doing a ToLower() on each string is a waste of performance.
Does anyone know what kind .Net collection I should use?
You should use a
new HashSet<string>(StringComparer.OrdinalIgnoreCase).Note that this is an unordered set.