HTML Limit
I would like to alter the html limits so that linqpad optionally uses a filestream and allows unlimited results on dump. I think using http://cefsharp.github.io/ to display the results would help. Even if I reference Linqpad in a custom program, there isn't a way I can see to make it dump to html with unlimited results.
Comments
<Extension()> Sub Dump(Of T)(objects As IEnumerable(Of T)) Dim pth As String = IO.Path.GetTempFileName & ".html" Using writer = LINQPad.Util.CreateXhtmlWriter(True) writer.Write(objects) My.Computer.FileSystem.WriteAllText(pth, writer.ToString, False) End Using Process.Start(pth) End Sub
Sample use:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim x = Enumerable.Range(0, Integer.MaxValue) x.Dump End Sub
Elias has provided the code to dump to file. To solve the limited number of lines due to limitation in Linqpad Dump, I commented out File.WriteAllText and replace by File.AppendAllText. Please look at the url link contributed by Elias below. Here is the sample code in C#
//Since the file written to will be in the appending mode. Start from scratch
File.Delete(path);
foreach (var item in millionsItems)
{
var writer = new DumpToFileExtensions.WriterWithdestination(path);
item.DumpToFile(writer);
writer.Writer.Close();
}
---------------------------------------
https://linqpad.uservoice.com/forums/18302-linqpad-feature-suggestions/suggestions/995247-dump-to-file
public static class DumpToFileExtensions
{
public class WriterWithdestination
{
public TextWriter Writer { get; }
public string FilePath { get; }
private DumpContainer dc { get; }
public DumpContainer LastDump { get; }
public WriterWithdestination(string filePath)
{
FilePath = filePath;
Writer = Util.CreateXhtmlWriter(true);
dc = new DumpContainer(Util.HorizontalRun(false, "output writing to ", new Hyperlinq(filePath, filePath))).Dump();
LastDump = new DumpContainer().Dump();
}
}
public static T DumpToFile(this T obj, WriterWithdestination writer)
{
return obj.DumpToFile(writer, null);
}
public static T DumpToFile(this T obj, WriterWithdestination writer, string title)
{
writer.LastDump.Content = "";
if (!string.IsNullOrWhiteSpace(title))
{
writer.LastDump.Content = Util.RawHtml(string.Format("
{0}", title)).DumpToFile(writer);
}
writer.Writer.Write(obj);
File.AppendAllText(writer.FilePath, writer.Writer.ToString());
// File.WriteAllText(writer.FilePath, writer.Writer.ToString());
writer.LastDump.Content = Util.VerticalRun(writer.LastDump.Content, obj);
return obj;
}
}