This is what I used:
Special thanks to this topic (especially the comments by Pat Kuyava and anunay)
C # (straight from Pat Kujawa's comment (although I did this so that it comes back myself, so that it works as a linqpad version)):
public static T Dump<T>(this T o) { var localUrl = Path.GetTempFileName() + ".html"; using (var writer = LINQPad.Util.CreateXhtmlWriter(true)) { writer.Write(o); File.WriteAllText(localUrl, writer.ToString()); } Process.Start(localUrl); return o; }
VB (my conversion, since I need it in a VB application):
Public Module LinqDebugging <System.Runtime.CompilerServices.Extension()> Public Function Dump(Of T)(ByVal o As T) As T Dim localUrl = Path.GetTempFileName() + ".html" Using writer = LINQPad.Util.CreateXhtmlWriter(True) writer.Write(o) File.WriteAllText(localUrl, writer.ToString()) End Using Process.Start(localUrl) Return o End Function End Module
You will need to add the linqpad executable as a reference in your project , as well as System.IO and System.Diagnostics
This launches your default web browser, showing the exact output linqpad will generate.
diceguyd30 May 17 '11 at 17:55 2011-05-17 17:55
source share