3
Answers

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

anilkumar.g

anilkumar.g

14y
8.1k
1

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)