Very easy to implement in C#, just pass 'StringComparer.OrdinalIgnoreCase' in the constructor, for example:
DictionaryHere is an an example in action:nameToIdTable = new Dictionary (StringComparer.OrdinalIgnoreCase);
[ Test ] public void CaseInsenstiveDictionaryTest() { var dictionary = new Dictionary(StringComparer.OrdinalIgnoreCase) { { "Mbukuravi", 1 }, { "Liaedin", 2 }, }; Assert.That( dictionary[ "Liaedin" ] == 2 ); Assert.That( dictionary[ "LiAEdin" ] == 2 ); Assert.That( dictionary[ "LiaeDIn" ] == 2 ); Assert.That( dictionary[ "LIAEDIN" ] == 2 ); }
No comments:
Post a Comment