Visual Studio - dump data during a debug session

Depending on a scenario simply paste the code below into the Immediate Window

If you happen to use Newtonsoft.Json:

System.IO.File.WriteAllText(@"c:\temp\debug_dump.json", Newtonsoft.Json.JsonConvert.SerializeObject(obj))

No json serializer? Try xml serializer then:

(new System.Xml.Serialization.XmlSerializer(obj.GetType())).Serialize(new System.IO.StreamWriter(@"c:\temp\debug_dump.xml"), obj)

Obviously the above will throw if an object is not serializable