Copy object values in Visual Studio debug mode

前端 未结 12 518
轻奢々
轻奢々 2021-01-29 19:17

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 t

12条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-29 19:34

    In the immediate window, type

    ?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.

    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.

    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.

提交回复
热议问题