Language Integrated Query (LINQ) is a Microsoft .NET Framework component that extends the language to provide a unified way to query collections and sequences. Those collections can either be local items or data in a remote database. LINQPad is a free IDE that allows you to create programs and to query databases. As its name suggests, LINQPad's main purpose is to write and run LINQ queries, but it can also execute C# or VB Scripts directly from its editor. Also, LINQPad is the perfect companion to learn LINQ!
Chapter 1, Discovering LINQPad, will introduce you to LINQPad, how to install it, how to configure it, and how to use it.
Chapter 2, Coding in LINQPad, will teach you how to use LINQPad as a practical tool to run quick tests and debug snippets of code.
Chapter 3, Learning LINQ Basics, will be your introduction to LINQ.
Chapter 4, Discovering LINQ Query Operators, will continue with LINQ by focusing on defining LINQ to objects and you will also learn about few LINQ query operators.
Chapter 5, Databases and Relational Data, will talk about the LINQ to SQL driver and more LINQ query operators.
Chapter 6, Using other Data Sources, will introduce you to more LINQ drivers: LINQ to XML, LINQ to Entity, and LINQ to WCF Data Services.
Chapter 7, Advanced LINQPad, will show you some of the more advanced features of LINQPad.
You will need a computer with the .Net Framework installed, with a minimum version of 4.0. You will of course need LINQPad, but Chapter 1, Discovering LINQPad, will provide directions to download and install it.
The following chapters have specific requirements, but they also include pointers on those said requirements:
This book is aimed at C# and .Net developers who wish to learn LINQ programming and test the easy way using LINQPad. No prior knowledge of LINQ or LINQPad is expected. A basic knowledge of SQL and XML is required for some chapters
In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text are shown as follows: "We can use OrderBy()
to sort a collection on a specific member of the object."
A block of code is set as follows:
void Main() { var deck = CreateDeck(); var randomCount = random.Next(52); var finalDeck = deck.Take(randomCount) .Where (card => card.Suit == "Hearts") .Skip(2) .Take(5) .OrderBy (card => card.FaceValue); // Display the result finalDeck.Dump(); }
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
void Main() { var deck = CreateDeck(); var randomCount = random.Next(52); var finalDeck = deck.Take(randomCount) .Where (card => card.Suit == "Hearts") .Skip(2) .Take(5) .OrderBy (card => card.FaceValue); // Display the result finalDeck.Dump(); }
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "click on the Set as default for new queries button".
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to <[email protected]>
, and mention the book title through the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website, or added to any list of existing errata, under the Errata section of that title.
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <[email protected]>
with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
You can contact us at <[email protected]>
if you are having a problem with any aspect of the book, and we will do our best to address it.