Author Options:

Keep getting "invalid token" errors in C# Answered

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.


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.