LINQ Cookbook, Recipe 12: Calculate the Standard Deviation (Doug Rothaus)

Ingredients: ·         Visual Studio 2008 (Beta2 or Higher)   Categories: LINQ to Objects   Introduction: LINQ Cookbook, Recipe 11 showed how you can use LINQ queries to perform calculations on sets of data using a set of standard aggregate functions such as Average, and Sum. In this recipe, you will learn how to add an… Read more

LINQ Cookbook, Recipe 11: Desktop Search Statistics (Doug Rothaus)

Ingredients: ·        Visual Studio 2008 (Beta2 or Higher)   Categories: LINQ to DataSet   Introduction: You can use aggregate functions in LINQ queries to perform calculations on sets of data. Visual Basic includes a set of standard aggregate functions for LINQ queries: All, Any, Average, Count, LongCount, Max, Min, Sum. These functions are documented in… Read more

Visual Basic 2008 Ships!!! (Amanda Silver)

Hooray! Today we’ve finally shipped Visual Studio 2008, previously known as “Orcas”, previously known as some symbol which doesn’t have an ascii representation. We’ve come a long way, but it’s been a great ride. In his blog, Soma mentions many of the flagship features at a high-level that will undoubtedly make the every developer and… Read more

LINQ Cookbook, Recipe 10: Pre-compiling Queries for Performance (Doug Rothaus)

Ingredients: ·         Visual Studio 2008 (Beta2 or Higher)   Categories: LINQ to SQL   Introduction: As we add cookbook entries, we will include performance improvement tips where appropriate. Here’s a tip that you can use with LINQ to SQL to speed up queries that you will call numerous times: Pre-compiled queries. By pre-compiling a query,… Read more

LINQ Cookbook, Recipe 9: Dynamic Sort Order (Doug Rothaus)

Ingredients: ·         Visual Studio 2008 (Beta2 or Higher)   Categories: LINQ-To-XML   Introduction: You can use the Order By clause to easily sort the results of a LINQ query in Visual Basic. A common requirement for sorted data, however, is that the user be able to choose the fields that the results are sorted by…. Read more

LINQ Cookbook, Recipe 8: Querying XML Using LINQ (Doug Rothaus)

Ingredients: ·         Visual Studio 2008 (Beta2 or Higher)   Categories: LINQ-To-XML   Instructions: ·         Create a new Console Application in Visual Basic. ·         Create an RSS document. Add the following code to Sub Main.     Dim rss = <?xml version=“1.0“?>               <rss version=“2.0“>                 <channel>                   <title>LINQ to XML in Visual Basic</title>                   <description>Sample RSS… Read more

LINQ Cookbook, Recipe 7: Selecting Pages of Data from Northwind (Jonathan Aneja)

  Ingredients: –          Visual Studio 2008 (Beta2 or Higher) –          Connection to Northwind database   Categories: LINQ-To-Objects, LINQ-To-SQL   Instructions: ·         Create a new Windows Forms project with a Northwind DataContext (for step-by-step instructions on how to do this please see Recipe #6) ·         Drop a DataGridView control from the Toolbox onto the Form ·        … Read more

Linq Cookbook, Recipe 6: Your first Linq Application using Northwind (Kit George)

This example is intended as a ‘primer’ for following recipes (so we don’t repeat the same instructions multiple times). This recipe takes you through everything you need, and assumes only that you’ve installed Visual Studio (and in so doing, you’ve installed SQLExpress). Subsequent Northwind based Linq-To-Sql recipes will point to this entry. Ingredients: –          Visual Studio… Read more

LINQ Cookbook, Recipe 5: Concatenating the selected strings from a CheckedListBox (Kit George)

Ingredients: –          Visual Studio 2008 (Beta2 or Higher)   Categories: LINQ-To-Objects, LINQ and WinForms   Instructions: Open Visual Studio 2008, and Click ‘File/New Project’. Create a new Windows Forms Application project From the toolbox, drag a CheckedListBox to the main form, and a button. Ensure the listbox is large enough to view multiple items DoubleClick… Read more

LINQ Cookbook, Recipe 3: Find all the prime numbers in a given range (Jonathan Aneja)

Ingredients: –          Visual Studio 2008 (Beta2 or Higher)   Categories: LINQ-To-Objects     Instructions: –          Open Visual Studio 2008, and Click ‘File/New Project’. Find and double-click the ‘Console Application’ Icon –         Add the following code:         Module Module1       Sub Main()         Dim primes = GetPrimesInRange(30, 50)           For Each n In primes… Read more