June 23rd, 2024

LINQPad – The .NET Programmer's Playground

LINQPad is a versatile tool for .NET programmers, supporting C#, F#, and VB snippets. It enables database querying, rich output formatting, debugging, C# 12 and .NET 8 support, caching, and advanced features like async/await. It serves as a learning tool with various functionalities.

Read original articleLink Icon
LINQPad – The .NET Programmer's Playground

LINQPad is a versatile tool for .NET programmers, offering the ability to test C#, F#, and VB snippets or programs instantly. It allows querying databases in LINQ or SQL across various platforms like SQL Server, Oracle, SQLite, and more. The tool provides rich output formatting, autocompletion, and integrated debugging features. LINQPad supports C# 12 and .NET 8, enabling interactive database querying with association properties generated automatically for relationships. Users can cache results for efficiency and benefit from the powerful Dump method for intelligent object graph visualization. LINQPad also supports advanced C# features like async/await and unsafe, making it suitable for rapid coding tasks, such as building neural networks. Additionally, LINQPad serves as a learning tool with examples from popular C# books and offers functionalities like benchmarking code, working with regular expressions, generating Excel files, and more. The tool is lightweight, easy to learn with integrated tutorials, and serves as a valuable asset for developers looking to streamline their coding and testing processes.

Related

Trealla Prolog: Compact and efficient Prolog interpreter

Trealla Prolog: Compact and efficient Prolog interpreter

Trealla Prolog is a compact interpreter written in C, compliant with ISO Prolog. It supports unbounded integers, UTF-8 atoms, efficient strings, and runs on Linux, Android, and WebAssembly. It offers C integration, SQLite access, concurrency features, and experimental functionalities. The project is open source under the MIT license.

RuneLite – open-source RuneScape Client

RuneLite – open-source RuneScape Client

RuneLite is a widely used open-source client for Old School RuneScape, boasting features such as Discord integration, GPU rendering, loot tracking, and status widgets. It has 181,000+ online players, version 1.10.31.3, and supports contributions, downloads for multiple platforms, tile markers, and a plugin hub. Developed with Bootstrap, React, and Font Awesome.

How to run an LLM on your PC, not in the cloud, in less than 10 minutes

How to run an LLM on your PC, not in the cloud, in less than 10 minutes

You can easily set up and run large language models (LLMs) on your PC using tools like Ollama, LM Suite, and Llama.cpp. Ollama supports AMD GPUs and AVX2-compatible CPUs, with straightforward installation across different systems. It offers commands for managing models and now supports select AMD Radeon cards.

Copy-on-Write Performance and Debugging

Copy-on-Write Performance and Debugging

The article discusses Copy-on-Write (CoW) linking in Dev Drive for Windows systems, enhancing performance during repo builds. CoW benefits C# projects, with upcoming Windows updates enabling CoW by default for faster builds.

How to Use Jupyter Notebooks: The Ultimate Guide – DataCamp

How to Use Jupyter Notebooks: The Ultimate Guide – DataCamp

Jupyter notebooks are crucial for technical and data work, offering code, output, and text in one document. DataLab, a hosted service, enhances collaboration and database connectivity. Popular among data professionals, they come in hosted and local types, with DataLab providing a user-friendly hosted option.

Link Icon 34 comments
By @justgaurav - 4 months
A long-time satisfied user of LINQPad. It is one of my must haves. I usually upgrade to the latest one when I hit some framework feature or a piece of snippet which requires it. It started as a very reasonably priced for the paid edition and there was only one paid edition for a long time. Nowadays, it is a bit pricier and has several editions (a suggestion would be to merge Pro and Developer editions).

I use LINQPad to manage my collection of snippets to do some ad hoc tasks on my machine. I also use it for testing out new code and learning about new features. It would be great when it becomes cross-platform, but last I heard Jo Albahari mentioned that the investment required was quite big and not worth it (at that time).

On the side note, I had a chance to see Jo Albahari's presentation few years ago in Sydney and I think he is unsung hero of .NET world (along with Ayende)!

By @xnorswap - 4 months
A true essential tool. One of the few pieces of software for which I own a personal license.

One of the useful features is that it keeps the executable running even after the script has finished, and will re-execute in the same process.

This has some downsides and quirks (if you're not careful, you can double-initialize things like database connections), but has benefits for debugging.

The newer versions have "built in" support for Benchmark.NET too which is a really nice feature for quickly proving code.

By @rjbwork - 4 months
Great piece of software that I basically use for scripting/notebooking. Been writing C# so long it's my lingua franca and this tool lets me do pretty much everything (except actual shell scripting for use on e.g. build servers and deployment pipelines) in C#.
By @rqtwteye - 4 months
Linqpad is one of the few tools that do what they need to do without much fuzz and in a straightforward manner. Beyond Compare is also in the same category.

I am glad that the UX people haven't gotten around to mess it up yet.

By @smokeydoe - 4 months
Also check out free open source alternative RoslynPad. https://roslynpad.net/
By @vunderba - 4 months
I haven't used Linqpad in a long time but one of the most useful features it had was the ability to add connections to your SQL Server databases and then write quick throwaway LINQ/Lambda style syntax queries against it, e.g.

   radios.GroupBy(x=> x.Channel).Select(x=>x.OrderBy(y=>y.Price)).Select(x=>x.First());
If I remember correctly, it also let you compare the LINQ query against the transpiled SQL so you could try to hand-optimize it a bit as well.
By @jodrellblank - 4 months
https://github.com/tareqimbasher/NetPad is a cross-platform C# playground, not as developed as LINQPad but gratis and libre (MIT License).
By @Nuzzerino - 4 months
Unfortunately, they still haven't gotten around to making it usable outside of Windows

https://forum.linqpad.net/discussion/1935/installation-on-ma...

By @kagevf - 4 months
This blog has some useful Linqpad tips: https://www.danclarke.com/linqpad-tips-and-tricks

In particular, keyboard shortcuts to toggle visibility on the different sub-windows, and using the Util class to prompt for a password I find to be useful.

By @mnau - 4 months
It's a nice program, but you need to pay to update every version of .net, which is every year.

I used to purchase premium version (single user) and the upgrade option is $97.50 instead of $125 for new license.

By @RexM - 4 months
Is there anything like this for Java. I really miss LINQPad since I’ve moved to a company that uses Java instead of C#.
By @deanebarker - 4 months
I use this constantly. Every single day. I have hundreds of scripts that run in it. It's just wildly valuable and useful.
By @replwoacause - 4 months
I've always wondered why it doesn't provide PowerShell support since it too is built atop .NET
By @readergreader - 4 months
Ditched it after realizing I'd have to pay for every .NET version change, and never looked back.
By @judah - 4 months
I've been a happy paid user of LINQPad for over 8 years now. Love it, well worth the price.
By @nlawalker - 4 months
I love LINQPad, it reminds me of first learning to program via DrJava in college. Just write and run code, completely free from all the configuration, structure and other concerns related to building and shipping a binary or other deliverable.
By @ed_elliott_asc - 4 months
I’ve never got used to linqpad over just creating a console app and writing code, it may be because I’ve never been one for keeping a collection of snippets?

I’m not against it, I just don’t need it

By @lf-non - 4 months
Also https://github.com/waf/CSharpRepl - if you want a conventional repl, also cross platform.
By @jasomill - 4 months
As someone with a strong bias towards interactive, investigative, "library-first" development, LINQPad is an essential part of my C# toolkit, as every other C# REPL and interactive environment I've tried has come up short in one significant way or another.

Essential LINQPad productivity features for me include:

1. Flexible visualization tools with sensible defaults and one-click export.

2. Ability to easily round-trip copy/paste code snippets between LINQPad and external IDE projects with minimal fuss (e.g., no boilerplate required for expressions, statements, or simple functions).

3. Automatic reloading of libraries I'm working on externally in an IDE with minimal IDE rebuild interference.

3. Completion on par with VS.

4. One-click document cloning.

5. NuGet integration, including the ability to search for and update referenced packages.

6. A simple, built-in debugger.

A typical LINQPad workflow for me (excluding tasks like writing documentation and unit tests for brevity):

1. Start with a task of accessing or exporting data from either a set of files in an unknown format or from an application — ideally, but not always, a Web application — without a documented API.

2. Create a library project in Rider or VS and a LINQPad document referencing the library.

3. Investigate the files or application interactively using LINQPad and other tools (hex editors for investigating binary formats, jq/IPython/PowerShell for JSON and XML, browser dev tools for Web apps, accessibility tools when automating Windows desktop apps, etc.).

4. Add data access mechanisms to the library.

5. Repeat steps 3 and 4 as necessary, with more and more work being done in LINQPad via the library on each iteration.

6. Build simple command-line or graphical tools on top of the library to allow non-programmers to access or export data from similar systems in the future without LINQPad. In cases where non-UI logic in these tools becomes non-trivial, I'll typically prototype this logic in LINQPad and extract it into a library, as well.

Finally, as new requirements arise, I can load up existing libraries and LINQPad to analyze and prototype solutions, often leading to initial results delivered to customers in minutes rather than hours.

By @XajniN - 4 months
If you’re using Sublime Text, you can install dotnet-script [1] and set up a new build system for .NET like this:

{ "file_patterns": ["*.cs"], "cmd": ["dotnet-script", "$file"] }

[1] https://github.com/dotnet-script/dotnet-script

By @enb - 4 months
Haven’t used it in a while but it was essential in helping me understand how the bcl and c# features behaved and worked. I love it
By @alhsn - 4 months
Awsome tool which I used for a while. Then I switched to RosylnPad because it was enough for my use cases, and it included intellecense.

Nowadays, I am looking for a notebook style editor (like jupyter notebook) that supports dotnet well and works with VS Code. I tried Polygot notebook a while back, but it kept crashing, so I un-installed it.

By @thefz - 4 months
I bought every major version. Truly a staple of my day to day job when I was working as a programmer. Invaluable scratchpad.
By @gsck - 4 months
I stumbled across this the other day, I was given an old SQL Server Compact database and needed to dump out some information from it, and LINQPad was the first program that was recommended.

Unfortunately the DB was SQLServer Compact 3.5 and for whatever reason LINQPad couldn't find the required assemblies to open it which was a shame

By @CodeCompost - 4 months
Honestly surprised that Microsoft have not bought this up and integrated it into Visual Studio. LINQPad is gold.
By @voidmain0001 - 4 months
I like that multiple databases can be used in the same scripting context. http://www.linqpad.net/FAQ.aspx#cross-database
By @bilekas - 4 months
I used to use this a few years back when my company was paying for it, but nowadays I dont work too much with dotnet but for all playground little things I use ideone.com it does it all in the browser.
By @MikeGale - 4 months
The program is gold. It enables you to speedily and almost effortlessly build up code, in a way that I haven't seen elsewhere.
By @NicoJuicy - 4 months
I've setup linqpad as a CMS for scripts and distributed it over nuget for support scripts.

Including login and etc.

Linqpad is great

By @FrustratedMonky - 4 months
In the background is this doing anything similar to what a F# typeprovider is doing?
By @figers - 4 months
Thought with a name like that it was for the iPad, wish it was...
By @loxias - 4 months
Borderline dangerous software. If it was reliable and worthy of supporting a stack, it wouldn't be Windows only.

By being Windows only, it conveys "toy" status. Professional database engineers don't use non-Linux, hence I can infer professionals don't use this.