Home

Realtime result logging to a growing table

Using LINQPad v5 (since I'm stuck to .NET Framework due to the dependency of external libraries I'm using). Most of the time, I'm using LINQPad to process records, based on a table in MSSQL server, using C# code.

Preferrably, I want to show the processed records in a (growing) table in the results window, and I want it to be updated/refreshed at real-time (during runtime). I tried to do this with a DumpContainer, by updating its content with the same (but growing) List after every single record that has been processed. That works, although it performs terribly slow after a few 100 records, causing LP to almost freeze... Also, it only shows the first 1000 records too.

Is there a better/more efficient way to do this?

Comments

  • edited July 10

    Dumping it as an HTML table (using Util.RawHtml) seems to do the trick. However, auto-scroll doesn't seem to work while updating the table. The cursor seems to stick to the table header/top. Is there a way to make it auto-scroll, so it will keep focus on the last line that has been added?

    See the attached code snippet.

  • edited July 10

    I believe this should be available in v5 but you could try dumping the table as an observable. I believe LINQPad handles rendering it more efficiently just adding the new rows for every entry to the existing table, instead of redrawing the entire table for every update. The 1000 row limit can be changed in the Preferences -> Results -> In Rich Text Mode.

    If you want to implement an auto scroll, you could try what was done here, though I'm not sure if all functions would be available in that version. I believe it's using the old IE renderer as well, so you might have problems with the mutation observer and would have to scroll from the C# side.

Sign In or Register to comment.