CHAPTER 1
LINQPad is a free software utility developed by Joseph Albahari to be used as part of .NET application development. It’s used to interactively query SQL databases using LINQ, as well as to interactively write C# code without needing an IDE such as Visual Studio. This feature expands its use as a “test tool” where C# code can be quickly prototyped outside the IDE. It also supports the VB.NET, SQL, and F# languages. LINQPad supports the following dialects:
There are several versions of the product; for the purposes of this book, we will focus on LINQPad 5 version 5.36.03, which is the current stable release at the time of writing.
LINQPad offers a series of benefits to the user, such as:
Note: A detailed explanation of LINQPad versions and other features can be found in my ebook LINQPad Succinctly.
You can download LINQPad 5 here.
Once you’ve downloaded LINQPad 5, double-click the setup program file LINQPad5Setup.exe to open it. For most users, this setup program can be found in the Downloads folder.
Figure 1: LINQPad Installation Program in User's Downloads Folder
After LINQPad is installed, a set of folders and files is created. These folders and files hold all the necessary elements that make LINQPad work properly, and are displayed in the following table.
Table 1: LINQPad folder structure.
Folder | Purpose |
|---|---|
Documents\LINQPad Queries | Holds all queries created by the user. LINQPad uses this folder to display those queries in a tree view named My Queries. |
Documents\LINQPad Plugins | Holds any custom assembly referenced by all or some queries. |
Documents\LINQPad Snippets | Holds custom code snippets (doesn’t apply for free edition). |
%LocalAppData%\LINQPad\drivers | Holds custom data context drivers which can be used in all queries. |
%AppData%\LINQPad\ConnectionsV2.xml | Stores all connections that appear in the Connections tree view. |
%AppData%\LINQPad\DefaultQuery.xml | Stores all assembly references that will be used by default in queries. |
%AppData%\LINQPad\RoamingUserOptions.xml | Stores the user preferences that dictate LINQPad behavior. |
Note: You can override the LINQPad default storage locations by creating a directory structure in the root install location of the LINQPad executable (which is C:\Program Files(x86)\LINQPad5 by default). For example, if you create a directory C:\Program Files(x86)\LINQPad5\Documents\LINQPad Queries and save queries there, when you ask LINQPad to open a query, it will search the new directory before searching the default directory.
The LINQPad user interface is where you will do most of your work. For the purposes of this book, we’ll identify 14 graphic elements of this interface. These elements are:

Figure 2: LINQPad User Interface and Its Elements
LINQPad uses the term query for every piece of code that is written in the editor. So from now on, this word will be used within this book for pointing to every code sample displayed in it.
We can save every one of these pieces of code for future use. By default, queries are saved in the LINQPad Queries folder located in the current user’s Documents folder. Also, after a query is saved, its name appears in the Queries and Samples tree view area of the user interface.

Figure 3: A LINQPad Query in the Queries and Samples Tree View Area
For the purposes of this book, every query written in LINQPad will be saved in a folder named LINQPad Samples. In my case, this folder will be located at D:\, but you can place this folder in any convenient directory.
LINQPad is a software utility developed by Joseph Albahari to be used as a part of .NET application development. It is used for interactively querying SQL databases using LINQ, as well as interactively writing C# code without the need for an IDE such as Visual Studio.
LINQPad supports the VB.NET, SQL, and F# languages. It also supports Entity Framework, LINQ to Objects, LINQ to SQL, and LINQ to XML dialects.
There are several versions of LINQPad, but for the purposes of this book, we will focus on the LINQPad 5 free version 5.36.03, which is the latest stable version according to the product’s website at the time of this writing.
LINQPad 5 can be downloaded here.
LINQPad 5 can be installed by downloading the product from the LINQPad website and double-clicking the setup program’s icon. Most users can find the installation program file in the Downloads folder.
After LINQPad is installed, a set of folders and files is created in order to make sure LINQPad works properly. These folders and files hold all elements needed by LINQPad, such as queries, plugins, code snippets, data context drivers, connections, default references, and user preferences.
The LINQPad user interface is where you will do most of your work. We have identified fourteen graphic elements in the LINQPad user interface for the purposes of this book. These elements are: the LINQPad main menu, Connection’s tree view area, Queries and Samples tree view area, Query code tab window area, Query code tab caption, Add New Tab button, Execute Query button, Stop Execution button, Results View Type button, Language Selector combo box, Connection Selector combo box, Close Tab button, Premium Features activation link, and Status Bar.
LINQPad uses the term query for every piece of code that is written in the editor and allows us to save this code onto disk. LINQPad stores queries in a folder named LINQPad Queries by default, located into the user’s Documents folder. All queries saved are displayed beneath a tree view node called My Queries.
For the purposes of this book, every query written in LINQPad will be saved in a folder named LINQPad Samples.