An object reference is required for the non-static field, method Error in console application

Nov 18 2009 4:26 PM

I have created a console application and declared a string a and assigning in code I am getting error.
 
namespace ConsoleApplication1
{
    class Program
    {
        string a;
        static void Main(string[] args)
        {
            Console.WriteLine("Hello!");
        }
       
    }
    
}

Answers (3)