Create a Hashtable using a case-insensitive code provider and a case-insensitive comparer,
using System;
using System.Collections;
using System.Globalization;
public class SamplesHashtable {
public static void Main() {
Hashtable myHT1 = new Hashtable();
myHT1.Add("FIRST", "Hello");
myHT1.Add("SECOND", "World");
myHT1.Add("THIRD", "3");
Hashtable myHT2 = new Hashtable( new CaseInsensitiveHashCodeProvider(), new CaseInsensitiveComparer() );
myHT2.Add("FIRST", "Hello");
myHT2.Add("SECOND", "World");
myHT2.Add("THIRD", "3");
}
}
Related examples in the same category