Dictionary Collection With A String Comparer

Based on the previous example. What would happen if you had a key value that was uppercase and you executed methods methods with key values in lowercase? You would get an error that the items wasn’t found. Or worse, if adding an item the method would add it. Then you would have multiple elements with the same key value pair. Not a good situation. That’s where the StringComparer class comes in handy when I’ll describe below. Continue reading