c# - C# 中的 Debug.WriteLine() - 它有什么作用?

标签 c# visual-studio

我想知道 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/

相关文章:

c# - 如何将已实例化的 IOC 容器传递给 Asp.net 5 应用程序?

c# - 为 ItemsControl 的每一项创建一个 ViewModel

visual-studio - Visual Studio调试

c# - 在 Visual Studio 中禁用 NServiceBus 营销弹出窗口

c++ - VS2015 CE - 无法找到 Link.exe

c++ - 在 Visual Studio 中从 C++ 代码中检索 AST

c# - LINQ BeginTransaction 可以使用新的 Context 吗?

c# - 使用 Ionic2-Angular2 前端和 ASP.NET 核心后端创建应用程序?

c# - child 的线程会在 parent 的线程死亡后死亡吗?

visual-studio - 在 VS 2015 中加载调试层 (VK_ERROR_LAYER_NOT_PRESENT)