管理されたdllを使用するアプリケーションがあります。それらのdllの1つは、一般的な辞書を返します。
Dictionary<string, int> MyDictionary;
辞書には大文字と小文字のキーが含まれています。
別の側面では、潜在的なキー(文字列)のリストを取得していますが、ケースを保証することはできません。キーを使用して辞書の値を取得しようとしています。しかしもちろん、ケースの不一致があるため、以下は失敗します。
bool Success = MyDictionary.TryGetValue( MyIndex, out TheValue );
I was hoping the TryGetValue would have an ignore case flag like mentioned in the MSDN doc, but it seems this is not valid for generic dictionaries.
Is there a way to get the value of that dictionary ignoring the key case? Is there a better workaround than creating a new copy of the dictionary with the proper StringComparer.OrdinalIgnoreCase parameter?