在Visual Studio调试模式下复制对象值 [英] Copy object values in Visual Studio debug mode

查看:1147
本文介绍了在Visual Studio调试模式下复制对象值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Visual Studio调试模式下,可以将鼠标悬停在变量上以显示其值,然后右键单击复制,复制表达式或复制值。

In Visual Studio debug mode it's possible to hover over variables to show their value and then right-click to "Copy", "Copy Expression" or "Copy Value".

如果变量是一个对象而不仅仅是一个基本类型,那么有一个扩展和浏览该对象的+号。它有一种将所有这些复制到剪贴板的方法?

In case the variable is an object and not just a basic type, there's a + sign to expand and explore the object. It there a way to copy all that into the clipboard?

推荐答案

在即时窗口中,键入

?name_of_variable

?name_of_variable

这将打印出一切,您可以手动复制任何你想要的地方,或使用立即窗口的日志功能可以自动将其写入文件。

This will print out everything, and you can manually copy that anywhere you want, or use the immediate window's logging features to automatically write it to a file.

更新:我假设你在问如何复制/粘贴嵌套的结构的值,以便您可以文本搜索,或者您可以将其保存在一边,然后比较对象的状态。如果我是对的,你可能想查看我创建的Visual Studio的商业扩展名为 OzCode ,通过搜索和比较功能,您可以更轻松地完成这些操作。

UPDATE: I assume you were asking how to copy/paste the nested structure of the values so that you could either search it textually, or so that you can save it on the side and then later compare the object's state to it. If I'm right, you might want to check out the commercial extension to Visual Studio that I created, called OzCode, which lets you do these thing much more easily through the "Search" and "Compare" features.

更新2 要回答@ ppumkin的问题,或新的EAP 有一个新的导出功能允许用户将变量值导出为Json,XML,Excel或C#代码。

UPDATE 2 To answer @ppumkin's question, or new EAP has a new Export feature allows users to Export the variable values to Json, XML, Excel, or C# code.

全面披露:我是这里介绍的工具的共同创始人。

Full disclosure: I'm the co-creator of the tool I described here.

这篇关于在Visual Studio调试模式下复制对象值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆