# C# errors :(



## Braveheart (Feb 18, 2009)

using System;


namespace program1
{
    class Program
    {
        //this is where your program starts.
        static void Main(string[] args)
        {
            //prompt user to enter a name.
            Console.WriteLine("Enter your name please");

            //now read the name entered.
            string name = Console.ReadLine();
        }

        //Greet the user with the name.
        Console.WriteLine("Hello, "+ namespace);

        //wait for user to acknowledge the results.
        Console.writeline("press enter to terminate...")
        Console.Read();

    }
}


Error	1	Invalid token '(' in class, struct, or interface member declaration	C:\Users\Luke\AppData\Local\Temporary Projects\program1\Program.cs	19	26	program1
Error	2	Invalid token '(' in class, struct, or interface member declaration	C:\Users\Luke\AppData\Local\Temporary Projects\program1\Program.cs	22	26	program1
Error	3	Invalid token '(' in class, struct, or interface member declaration	C:\Users\Luke\AppData\Local\Temporary Projects\program1\Program.cs	23	21	program1

 it won't let me put "("....anywhere.


----------



## FordGT90Concept (Feb 18, 2009)

Red is invalid code.

```
using System;


namespace program1
{
	class Program
	{
		//this is where your program starts.
		static void Main(string[] args)
		{
			//prompt user to enter a name.
			Console.WriteLine("Enter your name please");

			//now read the name entered.
			string name = Console.ReadLine();
		}
[COLOR="Red"]
		//Greet the user with the name.
		Console.WriteLine("Hello, "+ namespace);

		//wait for user to acknowledge the results.
		Console.writeline("press enter to terminate...")
		Console.Read();[/COLOR]

	}
}
```

fixed:


```
using System;


namespace program1
{
	class Program
	{
		//this is where your program starts.
		static void Main(string[] args)
		{
			//prompt user to enter a name.
			Console.WriteLine("Enter your name please");

			//now read the name entered.
			string name = Console.ReadLine();

			//Greet the user with the name.
			Console.WriteLine("Hello, "+ namespace);

			//wait for user to acknowledge the results.
			Console.writeline("press enter to terminate...")
			Console.Read();

		[COLOR="Green"]}  // Move your semicolon here[/COLOR]
	}
}
```

"Console" must be inside of a method.


----------



## Braveheart (Feb 18, 2009)

idk how i did that, thanks for pointing it out.


----------



## RevengE (Feb 18, 2009)

Braveheart said:


> idk how i did that, thanks for pointing it out.



LOL simple mistake thats all I do it all the time


----------

