我想知道 Debug.WriteLine()
做了什么。我一直在许多不同的代码中看到它,但我不明白它应该做什么。
到目前为止我发现了什么:
"Writes information about the debug to the trace listeners in the Listeners collection."
最佳答案
它将在 Visual Studio 底部的输出窗口中显示消息/文本,您可以使用它记录一些操作,例如“构造函数刚刚启动”,然后更容易找到错误出现的位置。另一件事是您可以将变量添加到调试输出中,例如:
Debug.WriteLine("Debug message:Shop.Add.Product({0})", Product);
在这里查看:Debug.WriteLine Method
关于c# - C# 中的 Debug.WriteLine() - 它有什么作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47924736/