简体   繁体   English

Visual C#2010 Express编译错误

[英]Visual c# 2010 express compiling error

I am new with c# I am using windows 8 and I want to learn this lenguage, so I open a new proyect and it gives the basics and I only add a single extra line, that should prints a "hi" but when I compile it, it only shows a black window were it suppouse to be my "hi", for compiling I press F6 then when it is compiled I press CTRL+F5 and the black box open, in the tutorials that exact thing works, please help what should I do? 我是C#的新手,我正在使用Windows 8,我想学习这种语言,因此我打开了一个新的proyect,它提供了基础知识,我只添加了一行,应该打印一个“ hi”,但在我编译时,它只显示一个黑色的窗口,是否可以作为我的“ hi”,对于编译,我按F6键,然后在编译时按CTRL + F5并打开黑框,在教程中确切的东西起作用,请帮忙我做?

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

namespace intro1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("hola"); //this is the only line added by me
        }
    }
}

Since this is a console application, the "black box" is where the program runs. 由于这是一个控制台应用程序,因此“黑匣子”是程序运行的地方。 In the upper left-hand corner of the box is where you should see the word, "hola". 在该框的左上角,您将看到“ hola”一词。

As the program ends immediately after the Console.WriteLine() , the "black box" (the console window) should disappear straight away. 由于程序在Console.WriteLine()之后立即结束,因此“黑匣子”(控制台窗口)应立即消失。

To make it pause so you've got time to see what has been printed, add another line to your program: 要使其暂停,以便您有时间查看已打印的内容,请在程序中添加另一行:

Console.ReadKey();

this will cause the app to pause until you press a key. 这将导致应用程序暂停,直到您按下某个键为止。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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