Search code examples
c#console.writeline

Console.WriteLine not printing out


I have a class Insurance and InsuranceTest these classes are part of a bigger project with an entry point static void main(string[] args). It is refusing to execute this entry point and doesn't print out my results.

INSURANCE CLASS

namespace IT
{

    class Insurance
    {

        int cust;

        string agent;

        string state;

        public Insurance(int cust, string agent, string state)
        {
            this.cust = cust;
            this.agent = agent;
            this.state = state;
        }
        public Insurance(int cust, string agent)
            : this(cust, agent, "")
        {

        }
        public int Cust
        {
            get { return cust; }
            set { cust = value; }
        }

        public string Agent
        {
            get { return agent; }
            set { agent = value; }
        }
        public string State
        {
            get { return state; }
            set { state = value; }
        }
        public static void main(string[] args)
        {
            Employee e1 = new Employee("Sugar", "Insurance Ave", 6534);


            e1.Name = "Sugar";

            e1.Address = "Insurance Ave";
            e1.Id = 6534;
            Console.WriteLine(e1.Name);
            Console.WriteLine(e1.Address);
            Console.WriteLine(e1.Id);
        }

    }

}

INSURANCE TEST Class

namespace IT
{
    class InsuranceTest
    {
         static void main(string[] args)
        {



            Insurance i1 = new Insurance(7, "Agent Store", "PA");

            i1.Customers = 7;

            i1.Agent = "Agent Store";
            i1.State = "PA";
            Console.WriteLine("Total Customers" + i1.Cust);
            Console.WriteLine(i1.Agent);
            Console.WriteLine(i1.State);

        }

    }
}

Note: InsuranceTest is not executing from an entry point. These are classes of many classes and when I go to the project's properties in Visual Studio and try to select and startup object. InsuranceTest does not even show up.


Solution

  • C# method names are case-sensitive. Main should be capitalized:

    static void Main(string[] args)
    {
        // Here ^