Copy object values in Visual Studio debug mode

前端 未结 12 515
轻奢々
轻奢々 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:20

    I always use:

    string myJsonString = JsonConvert.SerializeObject();
    

    Then I copy the string value which unfortunately also copies the back slashes.

    To remove the backlashes go here: https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_replace

    Then within the

    Visit Microsoft!

    element replace the text with the text you copied. then replace the var res = str.replace("Microsoft", "W3Schools"); line with

    var res = str.replace(/\\/g, '')
    

    Run these new changes but don't forget to click the "try it" button on the right.

    Now you should have all the text of the object in json format that you can drop in a json formatter like http://jsonformatter.org or to create a POCO you can now use http://json2csharp.com/

提交回复
热议问题