I have vocabulary entries that are read on Dictionary <string,string> myDict=null;
Dictionary <string,string> myDict=null;
The entries are as follows:
"user","Anthony" "lastLogin","May 10 2010 20:43"
How do I get lastLoginwith a lowercase key myDict["lastlogin"]?
lastLogin
myDict["lastlogin"]
The constructor for Dictionary<TKey,TValue>accepts a comparator object. You just need to pass in any mapper you want.
Dictionary<TKey,TValue>
var dic = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
Of course, you can convey things like CurrentCultureIgnoreCaseor InvariantCultureIgnoreCase, depending on your needs.
CurrentCultureIgnoreCase
InvariantCultureIgnoreCase
Pass IEqualityComparer<string>to the constructor Dictionary, for example StringComparer.CurrentCultureIgnoreCase.
IEqualityComparer<string>
Dictionary
StringComparer.CurrentCultureIgnoreCase