Strings the most commonly used data type .Many a times we may also use strings in Collections. The .NET Framework introduces special collection types to store string values which are the StringDictionary and the StringCollection classes which are from the System.Collections.Specialized.
First we see the StringCollection
The StringCollection class is a collection type used to store only string values the benefits of using StringCollection type is its type safe to use it when one is working with collection of string values.
StringCollection stringColl=new StringCollection();
stringColl.Add("Hefin");
stringColl.Add("DotNet");
stringColl.Add("Visual Basic");
string val=stringColl[1];//Does not need type casting like in ArrayList
Now for the StringDictionary class.
This class is similar to the HashTable class except for the keys and the values both have to be strings.
StringDictionary strDic=new StringDictionary();
strDic.Add("A","Hefin");
strDic["a"]="MyWorld" // Note that the keys are by default case insensitive
strDic.Add("B","Cool World");
string getVal=strDic["B"];
Hope these new specialized collection types for strings come handy for you.
Regards
Hefin Dsouza