LINQPad – The .NET Programmer's Playground
linqpad.net
linqpad.net
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)!
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.
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.
I am glad that the UX people haven't gotten around to mess it up yet.
[1]: https://winmerge.org
Always felt three way merges were a great way to melt human brains.
(though I end up disabling it to reduce extra pressure on language server when it's unneeded)
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.I often write/compile .NET Core code in watch mode and then use LinqPad to explore existing libraries.
https://forum.linqpad.net/discussion/1935/installation-on-ma...
Even Microsoft themselves understood this.
Half of Stack Overflow "developers" might not use Windows, but the relevant population to measure is C# developers.
Assuming as many Linux C# developers will buy the thing as Windows or MacOS developers do is an obvious mistake.
> Even Microsoft themselves understood this.
Microsoft understands, among other things, that they can't charge money for Linux tools.
> Microsoft understands, among other things, that they can't charge money for Linux tools.
It's the opposite trend going on, they embrace as much as possible Linux and port as much as they can.
How much of it is stuff that people actually pay for?
It's not as good as LINQPad, but it runs on the Mac.
Notice a common theme here? Literally zero ways to browse C# syntax trees available on the Mac. Nothing in the cloud either from what I could find. Roslyn was open-sourced in April 2014, which was 122 months ago. (edit: Another commenter pointed out that there is in fact a new VS Code extension that can do this, released Aug 2023)
By the way, you can't get autocomplete either while interactively debugging C# outside of Windows. The debugger is proprietary. Maybe there's a way, but I haven't found one.
Also, autocomplete works in VS Code debug tab just fine?
Please stop trying to make the windows point.
https://github.com/microsoft/vscode/issues/30065
https://github.com/microsoft/vscode/issues/48810
https://github.com/dotnet/vscode-csharp/issues/1609
https://github.com/dotnet/vscode-csharp/issues/299
https://github.com/microsoft/vscode-dotnettools/issues/573
https://github.com/dotnet/vscode-csharp/issues/5276#issuecom...
A Rider license costs $419 per year per seat and Jetbrains has a poor quality record by today's standards, and if you are a serious developer that has to use one of their products, you'll find yourself at the mercy of numerous YouTrack tickets that have been open for years. They have a habit of shipping integrations that are only partially working, and then calling it a day (or the better part of a decade).
By the way, Rider may have been cheaper if not for the above moves by Microsoft: https://github.com/dotnet/core/issues/505
Also, please do not link posts from Miguel De Icaza when he isn't in a good mood. He, unfortunately, does not provide constructive and/or unbiased criticism on .NET after moving out to Swift.
I'm not sure what point you are trying to make but current day support for C# on macOS and Linux is very good. It is even in a better shape than many other languages that have been platform-agnostic from the start, yet still don't have such good debugger, static analysis and profiler options.
It should be noted that $419/year is $35/mo, which is still $10/mo cheaper than the Visual Studio 2022 Professional monthly subscription at $45/mo. $21/mo at 3+ years is less than half.
As a side, it always strikes me as ironic that software developers are paid extremely well and yet hesitate to pay even a modest fee for the tools that enable them to do their job. Most "free" tools are not free - someone was paid to create them. IMO whether engineers are on a stable payroll is a differentiating aspect to why some tools succeed and become widely used and some don't. In the case of dev tools, our tech corporatocracy MAMA (Microsoft, Apple, Meta, Alphabet) pay engineers to make products like VS Code, then release for free. This is for eyeballs of course, because charging for the tools would get them nothing in comparison to their main platform revenue streams, which benefit hugely from the network effect.
Syntax trees can be browsed on https://sharplab.io/ or again via Rider and I'm sure there are some other tools that I'm not aware of.
The Roslyn sdk is part of .NET (cross platform) these days so anyone can use it to build a visualiser should they wish to.
Visual Studio for Mac (nee Mono Develop), could have been it, instead they decided to kill it, and focus on VSCode, which has already been communicated a couple of times, C# Dev Kit will never cover all use cases of VS proper, and it is also under the same license anyway.
So MAUI will never support GNU/Linux, was also not used in VS4Mac due to its Catalist underpinnings, Forms and WPF will stay Windows forever, MS will never used Uno or Avalonia, thus it leaves a Java IDE platform and Electron for their cross-platform tooling.
All, because regardless of what the .NET team does, upper management still wants to use .NET to drive Visual Studio and Windows licenses.
Where CPP devs would be without C# based IDE?
Where all devs would be without js/ts based vscode?
> The Roslyn sdk is part of .NET (cross platform) these days so anyone can use it to build a visualiser should they wish to.
Of course, but for most people that need this, they may just be trying to figure out how to do something as simple as adding an analyzer rule to a project, and don't have the luxury to be able to delay that work to spend weeks cobbling together a visualizer using an SDK that they may only have barely any knowledge with.
There are certain things that don't inspire the kind of passion it takes for volunteers to do this, and therefore it's up to those who have a financial motive to do so. Whether it be the rent-seekers at JetBrains, or someone other than Microsoft and doesn't have an incentive to make a competing OS more viable for developers. Without the .NET foundation's governance model and funding (regardless of who funded it), it would have never made it this far. See: https://github.com/dotnet/vscode-csharp/issues/5276
This is a gratuitously negative comment that is unfair and uses an incorrect metaphor. Rent-seeking is trying to charge for something without providing any new value, usually from something already established as free. I don't believe Rider was ever available for free, but even if it was, they certainly have improved it with loads of new value since then. You're welcome to your opinion (that I don't share) that their IDEs are not worth the cost, but you're also free to not buy them. That's not rent-seeking, it's the free market.
I personally am a big fan of Rider and the JetBrains Toolbox suite, and I get several times more value out of my subscription than it costs. YMMV.
Jetbrains has offered perpetual fallback licenses for all of their products for years now. This means that as long as you don't need any of the new updates, you can purchase it for a one time fee (basically the equivalent of a single year's license) and then you own it.
As far as their products not being worth what they charge, I pay about $180 per year (15$ / month) for the entire jetbrains library and consistently use CLion (for C and C++), Datagrip (postgres, mongo), Data rider (c#), Web storm (typescript), Phpstorm, and Pycharm. Considering these are the tools of my trade, that's more than a fair asking price.
They've also been incredibly responsive, especially considering the massive upheavals within the company as a result of the invasion of Ukraine by Russia. Whenever I've filed an issue on youtrack, it usually gets a response, and often a bug ticket that's handled within a few version iterations later at most.
Literally zero? I can count 2 from the top of my head.
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.
I used to purchase premium version (single user) and the upgrade option is $97.50 instead of $125 for new license.
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.
I’m not against it, I just don’t need it
The database integration is also great and allows me to write ad-hoc SQL queries using LINQ.
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.
{ "file_patterns": ["*.cs"], "cmd": ["dotnet-script", "$file"] }
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.
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
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.
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.
So in the end it's good all those tools stay independent and focused.
OP is speaking out of thin air. It's one of the best programming languages out there.
Not because C# is a bad language but because it’s not particularly good at anything. It’s a jack-of-all trades which isn’t even the best jack-of-all trades. So unless you have a lot of years put into it, either in your software stack or in your employees there is very little reason to use it in 2024.
But maybe you know of reasons to use that I’m not aware of?
It's extremely good for web APIs, for one.
By far the best developer experience I ever had was in C#.
I wish other langs like cpp or c were at least half as good at those as C#
C# was the first to get async/await, generics, LINQ, PLINQ etc - the path-breaking features that shoot up not only productivity but the ability to do certain things in a much better way.
Just because kids have caught up, it doesn't mean we are going to abandon the daddy.
but if you were going to pick a tech for a new project without a history of using C#, why would you pick it in 2024? If you’ve got a large .Net stack and a lot of experience with it, it’s still a great choice. I was a c# developer for a decade mind you, and I’m not sure I’ll ever use it again because it sort of lost its foothold despite being in a really great place.
I think you're just in a bubble. dotnet is widely used, and keeps getting better. I can program in many languages and yet csharp will very often be my go to for backend stuff because it's just the best.
Even on something like their MSGraph SDKs we’re often getting better performance out of the JavaScript SDKs.
I think it’s a little silly to say that Microsoft isn’t taking C# serious. If you look at Azure DevOps, which has not been taken very serious by Microsoft since they acquired GitHub and then compare it to C# there is just a world of difference. I do think it risks going that way. I’m not sure I think Visual Studio is taken fully serious anymore, but it’s still getting much more attention than Azure DevOps and C# is just… miles ahead of every product in terms of seriousness. I do think they are making it more and more like Typescript, I’m sure we’ll eventually see classes replaced by Types and functions being capable of living on their own, but that’s not really a bad thing.
You can use CsWin32[0] and CsWinRT[1] both of which provide rich generated bindings for their respective APIs. A colleague of mine recently got rid of C++ component thanks to the former, simplifying the solution build.
I’d be curious to know what percentage of people are still writing windows clients. I suspect there’s a lot of legacy code still out there, but it’s clearly not the future
Unfortunelly WinDev and XBox[0] only cares about C++ and COM nowadays, after they won over the whole Longhorn drama.
[0] - Managed DirectX and XNA were projects pushed by key engineers, folded after they weren't any longer around to argue for their projects.
Including login and etc.
Linqpad is great
You can make your own driver as well as use about a dozen of other drivers.
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.
What makes Linux uniquely appropriate for database engineering? Why not *BSD? What OS do you think engineers working with Microsoft SQL Server use?