10 ms·
LINQPad – The .NET Programmer's Playground
- smokeydoe 2y agoAlso check out free open source alternative RoslynPad. https://roslynpad.net/ https://roslynpad.net/
- celdon25 2y agoThe only reason I would use something like LINQPad is for the syntax tree and semantic analysis support, for compiler extensions. With a name like RoslynPad, seems funny that such a feature would be missing from that "alternative"
- neonsunset 2y agoIf you'd like to explore syntax tree and related IOperations, there is a VS Code extension https://marketplace.visualstudio.com/items?itemName=333fred.net-compiler-developer-sdk https://marketplace.visualstudio.com/items?itemName=333fred.... which lets you do just that, it has been very handy for writing source generators. (though I end up disabling it to reduce extra pressure on language server when it's unneeded)
- celdon25 2y agoAgain, only on Windows.
- neonsunset 2y agoI suppose my ARM-based Mac comes with weird Windows that looks like macOS!
- celdon25 2y agoSorry, you're right, I was using mobile at the time of the reply and thought that was the VS (non code) extension. I'll give it a try.
- runevault 2y agoInterestingly I tried this on my Dell ubuntu laptop and it doesn't work. May have to try and figure out why at some point.
- neonsunset 2y agoTry pre-release version, also needs newer Roslyn version so the SDK needs to be updated too. OS here doesn’t matter.
- runevault 2y agoPretty sure I'm on latest 8 SDK, but did not try pre release of the the addin so that could be it.
- neonsunset 2y agoIt uses a new Roslyn API to dump SyntaxTree and IOperation's starting at a specific span of source code IIRC, and it shipped in one of the minor version after .NET 8.0.0 release, it took me a bit to get it working upon its release but by this time you should have the necessary SDK, though the relevant extension version may still be marked as pre-release hence my suggestion.
- runevault 2y agoI messed with it a little more before going to bed. The prerelease version changed the error and at least felt like it was closer. But I also found there was a new SDK release in the last few days that I have not upgraded yet.
- rjbwork 2y agoGreat 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#.
- gdev_gabe 2y agonot sure if this is what you meant, but you can run linq files from the command line!
- NicoJuicy 2y agoThrough lprun ofc
- rjbwork 2y agoYeah for sure. I do set up crons on my local machine using linqpad scripts every now and then, because it's just my special little snowflake one off. But for Devops, build pipelines, etc. I prefer something a little more universally applicable and legible and that doesn't require a runtime. So bash is usually my approach there. Sometimes PowerShell if I know I'm going to be running it on a Windows box anyway. Much as I love C#, if I came into an environment and all the Devops/CI/CD was done using Linqpad and lprun I'd immediately wonder what in the actual fuck I had gotten myself into, lol.
- CodeCompost 2y agoHonestly surprised that Microsoft have not bought this up and integrated it into Visual Studio. LINQPad is gold.
- atlantic 2y agoThere is already a C# REPL built into Visual Studio, called C# Interactive. It takes a bit of getting used to, but it's not bad at all.
- recursive 2y agoNot even in the same zip code.
- mattmanser 2y agoEchoing the other comment, personally I find the C# interactive really frustrating to use. So close and yet so far. I often find it quicker/less frustrating to just fire up a new console app project. Last time I tried to use it I think it was even running an old version of .Net and you have to remember to switch the version.
- celdon25 2y agoI'd say it is pretty bad[1], but the F# REPL is decent at least. 1. https://github.com/dotnet/roslyn/issues/26934 https://github.com/dotnet/roslyn/issues/26934
- deleted 2y ago[deleted]
- misterflibble 2y agoYes I saw the REPL in VS 2022 and Jetbrains Rider, but I still prefer having this utility at hand with a collection of scripts ready whenever I need to script up something, or experiment with a service or database, or learn something new in .NET.
- fbdab103 2y agoThat is true of so many products. Notepad++, Paint.Net, Everything search. Products which would cost Microsoft absolute peanuts to acquire. Or even just use that as a model and rip it off entirely with an in house version.
- lf-non 2y agoAlso https://github.com/waf/CSharpRepl https://github.com/waf/CSharpRepl - if you want a conventional repl, also cross platform.
- bilekas 2y agoI 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.
- TibbityFlanders 2y ago[dead]
- celdon25 2y agoUnfortunately, they still haven't gotten around to making it usable outside of Windows https://forum.linqpad.net/discussion/1935/installation-on-macos#latest https://forum.linqpad.net/discussion/1935/installation-on-ma...
- vsuperpower2020 2y agoI don't bother making anything run on linux unless it's meant to run as a service. It's just not worth the time and trouble to test it on multiple operating systems, probably with different libraries, just for what is a very vocal minority.
- giancarlostoro 2y agoI have a really random winforms project I opened up the debug build of on Linux with Mono and had 0 issues. The bar can be very low.
- kid64 2y agoWait, that project actually got off the ground? Is this something you're using in production? What's a good starting point?
- n4r9 2y agoNot the comment you're replying to, but I also have a couple of internal winforms projects at work. They make it much easier to diagnose and debug issues with a backend service that works with GIS data, using libraries like GMap.NET. Come to think of it, the company's environment management tool is a Winforms application that gets used in every production instance. For basic UI tooling in a dotnet shop it's second to none.
- jagger27 2y agoOr use a Flatpak.
- realusername 2y ago
- MikeGale 2y agoThe program is gold. It enables you to speedily and almost effortlessly build up code, in a way that I haven't seen elsewhere.
- jodrellblank 2y agohttps://github.com/tareqimbasher/NetPad https://github.com/tareqimbasher/NetPad is a cross-platform C# playground, not as developed as LINQPad but gratis and libre (MIT License).
- novaleaf 2y agoI came here to say that also. NetPad is great, FOSS. Has all the features I need.
- figers 2y agoThought with a name like that it was for the iPad, wish it was...
- judah 2y agoI've been a happy paid user of LINQPad for over 8 years now. Love it, well worth the price.
- vunderba 2y agoI 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.
- kagevf 2y agoThis blog has some useful Linqpad tips: https://www.danclarke.com/linqpad-tips-and-tricks 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.
- voidmain0001 2y agoI like that multiple databases can be used in the same scripting context. http://www.linqpad.net/FAQ.aspx#cross-database http://www.linqpad.net/FAQ.aspx#cross-database
- mnau 2y agoIt'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.
- ryncewynd 2y agoYou pay for every LTS dotnet,so every 2 years. E.g Linqpad .Net8 license also supports .Net9
- mnau 2y ago> All licenses are perpetual (non-expiring) for the current major version, and include free minor updates. Major version are: LINQPad 2, 4, 5, 7 and 8. The official page seems to disagree. There is nothing about LTS. Sure, I can skip 7 and wait for 8, but that kind of defeats the purpose.
- LINQPad 2y agoThat's correct - we aim to ship a new major version every ~2 years, which for now aligns with every LTS. So LINQPad 8 will support .NET 9 (in fact, it already works with the .NET 9 previews.)
- RexM 2y agoIs there anything like this for Java. I really miss LINQPad since I’ve moved to a company that uses Java instead of C#.
- BadJo0Jo0 2y agoThese days across all languages, I just default to a Jupyter notebook.
- imachine1980_ 2y agoyou most likely use linq for query the database in your backend code not for data analytics related
- justgaurav 2y agoA 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)!
- LINQPad 2y agoRegarding a cross-platform version of LINQPad, I'm actively working towards supporting MacOS. I can't give a timeframe right now, but it might be sooner than later if XPF turns out to be a viable option.
- misterflibble 2y agoThank you for LINQPad and for your terrific presentations. They've certainly helped me build up my confidence in .NET development!
- loxias 2y agoBorderline 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.
- Kwpolska 2y agoThis tool is for software engineers, not database engineers. .NET is a Microsoft tool, and one that was tied to Windows for a long time, so most tooling is Windows-only too. What makes Linux uniquely appropriate for database engineering? Why not *BSD? What OS do you think engineers working with Microsoft SQL Server use?
- misterflibble 2y agoLINQPad is probably the most useful mini-IDE that I've ever used for .NET development and I employ it every single day for prototyping, scripting and experimenting. Joe Albahari developed it and he's renowned for his C# .NET expertise, so you're in great hands with this utility.
- deleted 2y ago[deleted]
- nlawalker 2y agoI 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.
- NicoJuicy 2y agoI've setup linqpad as a CMS for scripts and distributed it over nuget for support scripts. Including login and etc. Linqpad is great
- xnorswap 2y agoA 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.
- ed_elliott_asc 2y agoI’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
- liversage 2y agoOne of many useful features of LINQPad is the output visualizer ("Dump"). Granted, there are now NuGet packages (very likely inspired by LINQPad) that can do something similar in a console app but LINQPad is interactive, allows drill-down and can export to formats like Excel. It's such a productivity boost. The database integration is also great and allows me to write ad-hoc SQL queries using LINQ.
- bertylicious 2y agoThat's exactly the kind of thing I always hated about .net -- how the absence of a REPL forces me to create an executable for even the tiniest things. LINQPad solves this beautifully. Not sure if index ranges are inclusive or exclusive? Open LINQPad, double-click tab bar to open a new tab, type `"0123"[..^2]`, press ALT+X, done. I'd never go through the hassle to create an executable with VS for that, so instead I have to look up the documentation which is much more boring. And what's even better: countless times I was wondering what happens inside the framework and because LINQPad comes with ILSpy (I believe so, maybe you'll have to set it up) you can just F12 a framework method to see its source.
- T3RMINATED 2y ago[dead]
- gsck 2y agoI 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
- thefz 2y agoI bought every major version. Truly a staple of my day to day job when I was working as a programmer. Invaluable scratchpad.
- deanebarker 2y agoI use this constantly. Every single day. I have hundreds of scripts that run in it. It's just wildly valuable and useful.
- enb 2y agoHaven’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
- readergreader 2y agoDitched it after realizing I'd have to pay for every .NET version change, and never looked back.
- replwoacause 2y agoI've always wondered why it doesn't provide PowerShell support since it too is built atop .NET
- ygra 2y agoThe hosting API is completely different. Roslyn handles VB.NET and C# with basically the same API. Adding PowerShell is akin to writing the core part of all that a second time. Not that it can't be done, but most of the time PowerShell itself is already a capable REPL, so I guess there's also less need for it in LINQPad.
- replwoacause 2y agoThanks for that insight, makes a lot of sense.
- FrustratedMonky 2y agoIn the background is this doing anything similar to what a F# typeprovider is doing?
- steego 2y agoYes - When you connect to a database, it generates code for that database using something called a LinqPad Driver. You can make your own driver as well as use about a dozen of other drivers.
- rqtwteye 2y agoLinqpad 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.
- johnnyballgame 2y ago+1 Beyond Compare. It's been on my list of must installs for every new system I've set up for many years.
- gofreddygo 2y agoFor Windows OSes, winmerge [1] has been a solid free alternative to beyond compare for me for years. [1]: https://winmerge.org https://winmerge.org
- xcjs 2y agoDid they ever get around to three-way merges? That's a must-have if you use Git as a VCS.
- atVelocet 2y agoUse VSCode for this. Also has three-way merge.
- gofreddygo 2y agoI dont know. I Never use three way merges for anything productive. Always felt three way merges were a great way to melt human brains.
- alhsn 2y agoAwsome 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.
- mattzxmath 2y ago[dead]
- jasomill 2y agoAs 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.
- XajniN 2y agoIf 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 https://github.com/dotnet-script/dotnet-script