Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在编写一些非常复杂的代码,这些代码正在使用 XmlTextwriter 写入内存流。在我单步执行代码时,Visual Studio 调试中是否有办法查看 memorystream/XmlTextwriter 的内容。
从以下位置很容易得到它MemoryStream:
MemoryStream
Encoding.UTF8.GetString(stream.ToArray())
(假设您已经告诉它使用 UTF-8;Encoding.Unicode如有必要,请使用或任何合适的东西。)
Encoding.Unicode
问这个没有多大意义XmlTextWriter——它只是在写数据,可能不知道或不在乎它已经写了什么。请注意,您可能想冲洗它。
XmlTextWriter