简体   繁体   中英

C# basic hello world not running

新错误 运行时代码的输出

I am just trying to run a basic hello world program (or any program for that matter) and no matter what I do I always get this cmd terminal that pops up (even if I don't use Console.out.write() or any code at all) when I hit any key to continue the terminal closes and my code never runs. Please any help would be greatly appreciated I can't seem to find anybody else having this issue. I've attached a picture of the code used as well as the terminal that pops up (basically a screenshot of what happens after I click run).

Edit: I changed it to static and am now receiving this error, I placed it in a brand new project and everything there is no other files so not sure why I'm getting this, thank you all for the help!!

Your main method inside class Program should be a static method. - This is your entry point.

Add the static keyword to your main method.

static void Main(string[] args)
{
    Console.WriteLine("Hello World!");
    Console.ReadLine();
}

As @canton7 say, this code don't compile, then you run a old compiled version.

You can change this behavior in Tools -> Options : 在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM