Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can also call methods in the Immediate Window, and so I think your best bet would be to use an ObjectDumper object, like <a href="http://blogs.microsoft.co.il/blogs/bursteg/archive/2007/10/25/all-about-objectdumper.aspx" rel="nofollow">the one in the LINQ samples</a> or <a href="http://objectdumper.codeplex.com/" rel="nofollow">this one</a>, and then write something like this in the Immediate Window:</p> <blockquote> <p>File.WriteAllText("myFileName.txt", ObjectDumper.Dump(addressGraph));</p> </blockquote> <p>Depending on which ObjectDumper you decide to use, you may be able to customize it to suit your needs, and to be able to tell it how many levels deep you want it to dig into your object when it's dumping it.</p> <p><strong>UPDATE:</strong> You've clarified in the comment that the reason you want to save the data to file is so that you can search through it, and diff the collection at different points in time in the execution or different runs of the program. I actually wrote a commercial extension to Visual Studio (called <a href="http://www.bugaidsoftware.com" rel="nofollow">BugAid</a>) that does exactly that. With it, you can <a href="http://www.bugaidsoftware.com/features/#snapshots" rel="nofollow">take snapshots of variables</a> (by right clicking them and choosing "Save Variable") and then later on do a diff between a variable and the snapshot of its value that you have saved previously. The previous and current values of each item in the collection are presented side-by-side just like in the diff tool, and you can <a href="http://www.bugaidsoftware.com/features/#search" rel="nofollow">search</a> through as you compare the data.</p> <p>Note 1: Snapshots currently cannot be saved to file, and can only be compared to within the same debugging session.</p> <p>Note 2: In the current version of BugAid, both search and saving snapshots only works up to 3 levels of the object graph. In the next version you will be able to control how deeply you want to search/save data.</p> <p>Please let me know if this helps you or not.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload