c# - Console.WriteLine 不工作
问题描述
我正在做一个 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)
。我应该怎么办?
解决方案
推荐阅读
- python - IDE (Pycharm) 的最佳开放时间是什么时候?
- react-native - 导航栏没有隐藏在“react-native-router-flux”中的抽屉中
- android - java.lang.IllegalArgumentException:列“voiceID”不存在
- reactjs - Webpack 3 和 React - 如何引用捆绑包之外的文件?
- c++ - 如果我真的非常想从 STL 容器继承,并且我继承了构造函数并删除了 new 运算符,会发生什么?
- powerbi - 自定义 Power BI Embedded 报表
- java - 在java中使用BFS显示最短路径
- python - 用 OpenCV 检测圆形区域(有很多小物体)
- javascript - 是否可以从渐变或两种颜色之间的范围中选择随机颜色?
- python - 在 python 类中对对象执行计算