Console.WriteLine不起作用

时间:2018-05-02 18:59:38

标签: c# console-application

我正在做一个Windows窗体应用程序。我想从控制台获取信息。我找到了这段代码:

using System.Runtime.InteropServices;
using System;

[DllImport("kernel32.dll", SetLastError=true)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool AllocConsole();

private void Form_Load(object sender, EventArgs e)
{
     Console.WriteLine("Test");
}

控制台正在打开,但我看不到任何输出。我还尝试了System.Diagnostics.Debug.WriteLine(string message)System.Diagnostics.Trace.WriteLine(string message)。我该怎么办?

0 个答案:

没有答案