Is it possible to search through a Hashtable by a string using foreach? I am new to C# and seem to be struggling with correctly implementing the foreach statement. I am attempting to grab each word from a readline and put them individually in a hashtable. This is code that I am working with...
Code:
Hashtable table = new Hashtable();
StreamReader sr = File.OpenText(FILE_NAME);
String linetext = sr.ReadLine();
int i = 0;
foreach (string s in linetext)
{
table.Add(i, s);
i++;
}
[\code]
The error that I am getting is "cannot convert 'char' to 'string'", but I am never declaring a char???
Any suggestions???
Thanks!!