here is the error.
.exe'does not contain a static 'Main' method suitable for an entry point.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ObjectOriented
{
    class Greet
    {
       public void Hello()
        {
            Console.WriteLine("Hello World!");
            Console.ReadKey();
        }
    }
}
---------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ObjectOriented
{
    class TestClass
    {
        static void main(String[]args)
        {
            Greet test = new Greet();
            test.Hello();
        }
    }
}

Recommended Answers

All 2 Replies

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ObjectOriented
{
    class Program
    {
        static void Main(string[] args)
        {
            Greet test = new Greet();
            test.Hello();
        }
    }
    class Greet
    {
        public void Hello()
        {
            Console.WriteLine("Hello World!");
            Console.ReadKey();
        }
    }
}

I think this will solve you issue.

The problem is that C# is case sensitive and your Main method in line 27 is 'main' instead of 'Main' (assuming those are in different files).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.