المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : C#_Error "Namespace cannot directly contain..."



C# Programming
01-11-2012, 04:30 PM
As I am new at this, and this is my first attempt at actually writing code, some of you may chuckle (or laugh out loud at the simplistic code)... please be merciful.

I keep getting the error message: A namespace cannot directly contain members such as fields or methods"

I have visited MSDN, and virtually every google and bing hit out there, but no matter how I change the first entry, I get the same message. Could someone help?

using System;using System.Collections.Generic;using System.Linq;using System.Text; namespace _11012_debproject_2{ class Program { static void Main(string[] args); int number1; int number2; int Multiply; // prompt user // enter first number} Console.WriteLine( "Enter first number:" ) number1 (Console.Readline()); // prompt user // enter second number Console.WriteLine( "Enter second number:") number2 ( Console.ReadLine()); product = number1 * number2; // multiply numbers Console.WriteLine( "product is {0}",product );} // display product} }