【问题标题】:No entry point. Program does not contain a suitable 'Main' method [closed]没有切入点。程序不包含合适的“主要”方法[关闭]
【发布时间】:2020-07-01 08:00:08
【问题描述】:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CLASSES_2
{
    class Building
    {
        public int Area; // total square footage of building
        public int Floors; // number of floors
        public int Occupants; // number of occupants
    }
    class Building_Demo
    {
       static void main(string[] args)
        {
            Building house = new Building();
            int Area_Per_Person;

            house.Area = 4000;
            house.Floors = 7;
            house.Occupants = 10;

            Area_Per_Person = house.Area / house.Occupants;

            Console.WriteLine("The house has: \n" + house.Floors + " Floors \n" + house.Occupants + " Occupants"
                + house.Area + "Area \n" + Area_Per_Person + " Area_Per_Person: ");
        }
  }
}

谁能告诉我我的代码有什么问题?它告诉我没有适合入口点的方法。

CS5001 程序不包含适用于入口点的静态“Main”方法。

【问题讨论】:

    标签: c# class main


    【解决方案1】:

    方法名称区分大小写。该方法应该被称为Main,大写字母M,而不是像你现在拥有的main

    static void Main(string[] args)
    

    【讨论】:

    • 谢谢。
    • @Fakhr,请阅读this
    猜你喜欢
    • 2022-07-06
    • 2014-12-13
    • 2017-01-22
    • 2012-04-21
    • 1970-01-01
    • 1970-01-01
    • 2013-06-10
    • 2013-04-14
    • 2018-05-02
    相关资源
    最近更新 更多