Dotnet

LINQPad Premium v7.7.15

LINQPad is not just for LINQ queries, but any C#/F#/VB expression, statement block or program. Put an end to those hundreds of Visual Studio Console projects cluttering your source folder and join the revolut...

Description

LINQPad is not just for LINQ queries, but any C#/F#/VB expression, statement block or program. Put an end to those hundreds of Visual Studio Console projects cluttering your source folder and join the revolution of LINQPad scripters and incremental developers. Reference your own assemblies and NuGet packages. Prototype your ideas in LINQPad and then paste working code into Visual Studio. Or call your scripts directly from the command-line. Experience LINQPads rich output formatting, optional debugger and autocompletion, and the magic of dynamic development and instant feedback!

LINQPad: The Ultimate .NET Scratchpad
LINQPad can run not only LINQ queries, but any C#/F#/VB expression, statement or program.
For instance, have you ever needed to test a DateTime format string? In LINQPad, just enter the expression and hit F5:

With LINQPad's instant edit/run cycle and optional full autocompletion, you'll have code snippets fully tweaked in less time than it takes to bring up Visual Studio's Add Reference dialog!

What about testing a regular expression? You'll start using Regex a lot more once you have LINQPad:

Notice how LINQPad nicely formats the Match object. Complex object graphs are much more readable in LINQPad's output window.

To run a series of statements, just change the "Language" combo to Statements (or hit Ctrl+2):

Again, you can keep tweaking your code until it does what you want, then paste working code into Visual Studio.

You can even run a full program with additional methods: just change the Language to Program, and LINQPad will wrap your code in a Main method so you can write additional methods and classes.

Need to reference custom assemblies or NuGet references? No problem: just hit F4 for the Add Reference dialog.

Additional benefits:

LINQPad reports the execution time in the status bar, so you won't have to manually create a Stopwatch class for performance testing.
Want to test a variation of your snippet? Ctrl+Shift+C instantly clones your snippet so you can run another version side-by-side.
You can return to saved queries in single click, thanks to the My Queries treeview. Use LINQPad as a scripting tool!
You can call Dump on any WPF or Windows Forms control and LINQPad will render it. This is a great way to write custom visualizers.
In the My Queries treeview, you'll see a query called My Extensions. Here's where you can write methods and classes that will be available to all queries.

New Features - AI Personal Assistant [Preview]

LINQPad Premium Edition users now have access to an OpenAI-based personal assistant. To enable, go to Edit | AI > Settings, and follow the instructions to enable and link to your ChatGPT or Azure OpenAI account. Once enabled, pressing Ctrl+P will display a list of prompts, each of which starts a ChatGPT-style conversation.

All messages in the conversations can be edited on each submission (including system prompts), and by clicking Save, you can create custom prompts that will appear in the main list. There are also options to compare assistant-generated code with your own, and replace or insert AI code into the editor.

Conversations can optionally incorporate selected code from your query, as well as the current runtime error or compilation error message.
Show screenshots

Note that this feature is subject to change as the LLM APIs evolve.
New Features - AI Completion [Preview]

LINQPad Premium Edition users also now have access to AI-based code completion with Shift+Space or Ctrl+Alt+. This is similar to GitHub Copilot, but does not require a monthly subscription; instead, it works with your ChatGPT/OpenAI or Azure OpenAI account, currently using the low-cost GPT-3.5-turbo model. To enable, go to Edit | AI > Settings. Here are ideas to get you started:

Writing a method from its signature:

int IndexOfMaxValue (double[] values) Shift+Space

Writing code from a comment:

string jsonText = """{ "FirstName": "Alice", "Address": { "City": "New York" } } """;

// Parse jsonText into a JsonNode and extract the city
Shift+Space

Demonstrating use of a NuGet package:

// Show me how to get started with the CsvHelper package in LINQPad.
Shift+Space

(Telling OpenAI that we're using LINQPad helps it to avoid wrapping code in a Program class.)
Writing repetitive code such as a constructor:

public class Frame
{
public readonly Rect SetBounds;
public readonly int Width, Height;
uint[] _pixels;

public Frame (Shift+Space
}

Creating sample dаta:

// Create 10 customers with random names
Customer[] customers = new[]
{
new Customer ("Alice", "Brown", "Seattle"),
Shift+Space
};

record Customer (string FirstName, string LastName, string City);

New Features - Other

The NuGet package manager now displays and orders packages by ID rather than title. There are also now new links to view the package online in the NuGet Package Explorer, the FuGet Package Explorer, and on nuget.org.
LINQPad has a new Formatting options page in Edit | Preferences to control the display of numbers (as well as dates and times). There are options to display thousands/group separators, specify custom numeric format strings, and choose between local or invariant culture. These options work without upsetting LINQPad's Toggle Graph Column feature in the results output (regardless of culture settings) and are also respected when results are sent to data grids. And when editing data grids, the parser now always permits numeric group separators - and honors your choice of local or invariant culture.
The F# compiler service has been updated to support F# 7.0.
When dumping JsonDocument or JsonNode objects, LINQPad now avoids unnecessary escape sequences in strings.
The code editor now supports horizontal scrolling via Shift+MouseWheel.
Quick-info tooltips now recognize constructor invocations.
There are new options to control which keys accept autocompletion items, in Edit | Preferences > Advanced.
The My Queries TreeView now shows .cs and .fs files (in addition to .linq, .sql, .json, .xml, .csv, .txt and .config files). An even greater range of file extensions is supported through the File | Open dialog.
You can now re-order data grid panels in the output with Alt+drag. Rendering has also improved when there are a large number of panels.
The Util.Highlight method to highlight data with a background color now also works with data grids.
The BenchmarkDotNet visualizer now excludes upper outliers by default, for consistency with BenchmarkDotNet's default logger. To include upper outliers, call RunBenchmark with includeUpperOutliers:true, or open the BenchmarkDotNet query and edit the default parameter value.

Fixes

LINQPad's EF Core data context generator now emits the HasTrigger annotation on EF Core 7 tables with triggers or computed columns, so that updates can still work.
LINQPad's EF Core data context generator now includes a workaround to prevent EF Core from inferring multiple auto-gen columns in a table or view.
The "Open in Windows Explorer" feature now works with file paths longer than 255 characters.
The lambda expression writer now shows DbSet properties correctly with EF Core.

Additional Information