Keep getting "invalid token" errors in C#

I've spent the last few days trying to learn the C# language, but Visual C# 2008 keeps saying "invalid token" when my syntax is perfectly fine. Here is my source code:

            string path = "startup";
            private Hashtable text = new Hashtable();
            text.Add("startup", "Please type a command. For a list of available commands, type <help>.");
            Console.WriteLine("Start up complete.");
            while (true)
                string info = text[path].ToString();
                string comm = Console.ReadLine();
                if (comm == "help")

The main thing it keeps rejecting are the parentheses. I've even tried removing them, to no avail. I would vastly appreciate some help.

sort by: active | newest | oldest
lemonie5 years ago

i wonder if this will be of any use?

dungeon runner (author)  lemonie5 years ago
No dice - It doesn't work with C# :(.

oh dear. i couldn't see a fault with your code

dungeon runner (author)  lemonie5 years ago
The numerous problems with the Hash table were fixed when I added "using System.Collections" to the top. Everything else just fixed itself. Sigh, Visual Studio is a fickle beast indeed.


well we've learned something then, thanks for the update.