Rav*_*mes 5 c# console-application
刚开始使用C#,我正在尝试做非常简单的事情,其中之一就是更改 控制台标题。
我正在遵循这些说明:Console.Title Property
上面的链接来自Microsoft 文档,当我将其复制到我的程序中时,它就可以工作了!
当我尝试做同样的事情时,甚至更简单......标题根本没有改变。
我的代码:
using System;
namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
Console.Title = "Hello World Program";
}
}
}
Run Code Online (Sandbox Code Playgroud)
我的输出:
我究竟做错了什么?我必须采取一些我不知道的额外步骤?
感谢您的时间和帮助。
程序退出后,控制台将不再具有您设置的标题。在程序退出之前,在末尾使用断点来查看标题是什么。
Console.Title = "New";
return; // Set a breakpoint here.
Run Code Online (Sandbox Code Playgroud)
或者您可以简单地添加“按任意键继续”(根据 MS 文档)
Console.WriteLine("Note that the new console title is \"{0}\"\n" +
" (Press any key to quit.)", Console.Title);
Console.ReadKey(true);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2819 次 |
| 最近记录: |