You are on page 1of 149

Where - Simple 1

This sample prints each element of an input integer array whose value is less than 5. The sample uses a query expression to create a new sequence of integers and then iterates over each element in the sequence, printing its value. public void Linq1() { int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; var lowNums = from n in numbers where n < 5 select n; Console.WriteLine("Numbers < 5:"); foreach (var x in lowNums) { Console.WriteLine(x); } } Result Numbers < 5: 4 1 3 2 0

Where - Simple 2
This sample prints a list of all products that are out of stock. It selects each item from the product list where the number of units in stock equals zero. public void Linq2() { List products = GetProductList(); var soldOutProducts = from p in products where p.UnitsInStock == 0 select p; Console.WriteLine("Sold out products:"); foreach (var product in soldOutProducts) { Console.WriteLine("{0} is sold out!", product.ProductName); } } Result

Sold out products: Chef Anton's Gumbo Mix is sold out! Alice Mutton is sold out! Thringer Rostbratwurst is sold out! Gorgonzola Telino is sold out! Perth Pasties is sold out!

Where - Simple 3
This sample lists all expensive items in stock. It uses a query expression that selects items from the product list where the number of items in stock is non-zero and the item's unit price is greater than 3.00 public void Linq3() { List products = GetProductList(); var expensiveInStockProducts = from p in products where p.UnitsInStock > 0 && p.UnitPrice > 3.00M select p; Console.WriteLine("In-stock products that cost more than 3.00:"); foreach (var product in expensiveInStockProducts) { Console.WriteLine("{0} is in stock and costs more than 3.00.", product.ProductName); } } Result In-stock products that cost more than 3.00: Chai is in stock and costs more than 3.00. Chang is in stock and costs more than 3.00. Aniseed Syrup is in stock and costs more than 3.00. Chef Anton's Cajun Seasoning is in stock and costs more than 3.00. Grandma's Boysenberry Spread is in stock and costs more than 3.00. Uncle Bob's Organic Dried Pears is in stock and costs more than 3.00. Northwoods Cranberry Sauce is in stock and costs more than 3.00. Mishi Kobe Niku is in stock and costs more than 3.00. Ikura is in stock and costs more than 3.00. Queso Cabrales is in stock and costs more than 3.00. Queso Manchego La Pastora is in stock and costs more than 3.00. Konbu is in stock and costs more than 3.00. Tofu is in stock and costs more than 3.00. Genen Shouyu is in stock and costs more than 3.00. Pavlova is in stock and costs more than 3.00. Carnarvon Tigers is in stock and costs more than 3.00. Teatime Chocolate Biscuits is in stock and costs more than 3.00. Sir Rodney's Marmalade is in stock and costs more than 3.00. Sir Rodney's Scones is in stock and costs more than 3.00. Gustaf's Knckebrd is in stock and costs more than 3.00.

Tunnbrd is in stock and costs more than 3.00. Guaran Fantstica is in stock and costs more than 3.00. NuNuCa Nu-Nougat-Creme is in stock and costs more than 3.00. Gumbr Gummibrchen is in stock and costs more than 3.00. Schoggi Schokolade is in stock and costs more than 3.00. Rssle Sauerkraut is in stock and costs more than 3.00. Nord-Ost Matjeshering is in stock and costs more than 3.00. Mascarpone Fabioli is in stock and costs more than 3.00. Sasquatch Ale is in stock and costs more than 3.00. Steeleye Stout is in stock and costs more than 3.00. Inlagd Sill is in stock and costs more than 3.00. Gravad lax is in stock and costs more than 3.00. Cte de Blaye is in stock and costs more than 3.00. Chartreuse verte is in stock and costs more than 3.00. Boston Crab Meat is in stock and costs more than 3.00. Jack's New England Clam Chowder is in stock and costs more than 3.00. Singaporean Hokkien Fried Mee is in stock and costs more than 3.00. Ipoh Coffee is in stock and costs more than 3.00. Gula Malacca is in stock and costs more than 3.00. Rogede sild is in stock and costs more than 3.00. Spegesild is in stock and costs more than 3.00. Zaanse koeken is in stock and costs more than 3.00. Chocolade is in stock and costs more than 3.00. Maxilaku is in stock and costs more than 3.00. Valkoinen suklaa is in stock and costs more than 3.00. Manjimup Dried Apples is in stock and costs more than 3.00. Filo Mix is in stock and costs more than 3.00. Tourtire is in stock and costs more than 3.00. Pt chinois is in stock and costs more than 3.00. Gnocchi di nonna Alice is in stock and costs more than 3.00. Ravioli Angelo is in stock and costs more than 3.00. Escargots de Bourgogne is in stock and costs more than 3.00. Raclette Courdavault is in stock and costs more than 3.00. Camembert Pierrot is in stock and costs more than 3.00. Sirop d'rable is in stock and costs more than 3.00. Tarte au sucre is in stock and costs more than 3.00. Vegie-spread is in stock and costs more than 3.00. Wimmers gute Semmelkndel is in stock and costs more than 3.00. Louisiana Fiery Hot Pepper Sauce is in stock and costs more than 3.00. Louisiana Hot Spiced Okra is in stock and costs more than 3.00. Laughing Lumberjack Lager is in stock and costs more than 3.00. Scottish Longbreads is in stock and costs more than 3.00. Gudbrandsdalsost is in stock and costs more than 3.00. Outback Lager is in stock and costs more than 3.00. Flotemysost is in stock and costs more than 3.00. Mozzarella di Giovanni is in stock and costs more than 3.00. Rd Kaviar is in stock and costs more than 3.00.

Longlife Tofu is in stock and costs more than 3.00. Rhnbru Klosterbier is in stock and costs more than 3.00. Lakkalikri is in stock and costs more than 3.00. Original Frankfurter grne Soe is in stock and costs more than 3.00.

Where - Drilldown
This sample prints a list of customers from the state of Washington along with their orders. A sequence of customers is created by selecting customers where the region is 'WA'. The sample uses doubly nested foreach statements to print the order numbers for each customer in the sequence. public void Linq4() { List customers = GetCustomerList(); var waCustomers = from c in customers where c.Region == "WA" select c; Console.WriteLine("Customers from Washington and their orders:"); foreach (var customer in waCustomers) { Console.WriteLine("Customer {0}: {1}", customer.CustomerID, customer.CompanyName); foreach (var order in customer.Orders) { Console.WriteLine(" Order {0}: {1}", order.OrderID, order.OrderDate); } } } Result Customers from Washington and their orders: Customer LAZYK: Lazy K Kountry Store Order 10482: 3/21/1997 12:00:00 AM Order 10545: 5/22/1997 12:00:00 AM Customer TRAIH: Trail's Head Gourmet Provisioners Order 10574: 6/19/1997 12:00:00 AM Order 10577: 6/23/1997 12:00:00 AM Order 10822: 1/8/1998 12:00:00 AM Customer WHITC: White Clover Markets Order 10269: 7/31/1996 12:00:00 AM Order 10344: 11/1/1996 12:00:00 AM Order 10469: 3/10/1997 12:00:00 AM Order 10483: 3/24/1997 12:00:00 AM Order 10504: 4/11/1997 12:00:00 AM Order 10596: 7/11/1997 12:00:00 AM Order 10693: 10/6/1997 12:00:00 AM Order 10696: 10/8/1997 12:00:00 AM Order 10723: 10/30/1997 12:00:00 AM Order 10740: 11/13/1997 12:00:00 AM

Order 10861: 1/30/1998 12:00:00 AM Order 10904: 2/24/1998 12:00:00 AM Order 11032: 4/17/1998 12:00:00 AM Order 11066: 5/1/1998 12:00:00 AM

Where - Indexed
This sample uses an indexed Where clause to print the name of each number, from 0-9, where the length of the number's name is shorter than its value. In this case, the code is passing a lambda expression which is converted to the appropriate delegate type. The body of the lambda expression tests whether the length of the string is less than its index in the array. public void Linq5() { string[] digits = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" }; var shortDigits = digits.Where((digit, index) => digit.Length < index); Console.WriteLine("Short digits:"); foreach (var d in shortDigits) { Console.WriteLine("The word {0} is shorter than its value.", d); } } Result Short digits: The word five is shorter than its value. The word six is shorter than its value. The word seven is shorter than its value. The word eight is shorter than its value. The word nine is shorter than its value.

========================================================== ===========================Select - Simple 1


This sample prints a sequence of integers one greater than those in an input array. The sample uses the expression in the select clause to add one to each element in the new sequence. public void Linq6() { int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; var numsPlusOne = from n in numbers select n + 1; Console.WriteLine("Numbers + 1:"); foreach (var i in numsPlusOne) { Console.WriteLine(i);

} } Result Numbers + 1: 6 5 2 4 10 9 7 8 3 1

Select - Simple 2
This sample prints the name of every product in the product list. It uses select to create a sequence of each product name. public void Linq7() { List products = GetProductList(); var productNames = from p in products select p.ProductName; Console.WriteLine("Product Names:"); foreach (var productName in productNames) { Console.WriteLine(productName); } } Result Product Names: Chai Chang Aniseed Syrup Chef Anton's Cajun Seasoning Chef Anton's Gumbo Mix Grandma's Boysenberry Spread Uncle Bob's Organic Dried Pears Northwoods Cranberry Sauce Mishi Kobe Niku Ikura Queso Cabrales Queso Manchego La Pastora Konbu

Tofu Genen Shouyu Pavlova Alice Mutton Carnarvon Tigers Teatime Chocolate Biscuits Sir Rodney's Marmalade Sir Rodney's Scones Gustaf's Knckebrd Tunnbrd Guaran Fantstica NuNuCa Nu-Nougat-Creme Gumbr Gummibrchen Schoggi Schokolade Rssle Sauerkraut Thringer Rostbratwurst Nord-Ost Matjeshering Gorgonzola Telino Mascarpone Fabioli Geitost Sasquatch Ale Steeleye Stout Inlagd Sill Gravad lax Cte de Blaye Chartreuse verte Boston Crab Meat Jack's New England Clam Chowder Singaporean Hokkien Fried Mee Ipoh Coffee Gula Malacca Rogede sild Spegesild Zaanse koeken Chocolade Maxilaku Valkoinen suklaa Manjimup Dried Apples Filo Mix Perth Pasties Tourtire Pt chinois Gnocchi di nonna Alice Ravioli Angelo Escargots de Bourgogne Raclette Courdavault Camembert Pierrot

Sirop d'rable Tarte au sucre Vegie-spread Wimmers gute Semmelkndel Louisiana Fiery Hot Pepper Sauce Louisiana Hot Spiced Okra Laughing Lumberjack Lager Scottish Longbreads Gudbrandsdalsost Outback Lager Flotemysost Mozzarella di Giovanni Rd Kaviar Longlife Tofu Rhnbru Klosterbier Lakkalikri Original Frankfurter grne Soe

Select - Transformation
This sample prints the name of each number in an integer array by indexing into a second array that contains the names. public void Linq8() { int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; string[] strings = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" }; var textNums = from n in numbers select strings[n]; Console.WriteLine("Number strings:"); foreach (var s in textNums) { Console.WriteLine(s); } } Result Number strings: five four one three nine eight six seven

two zero

Select - Anonymous Types 1


This sample prints uppercase and lowercase versions of each string in an input array. The sample demonstrates the use of an anonymous type in the select expression. The anonymous type has two members, Upper and Lower, that are the upper and lowercase versions of the string. public void Linq9() { string[] words = { "aPPLE", "BlUeBeRrY", "cHeRry" }; var upperLowerWords = from w in words select new {Upper = w.ToUpper(), Lower = w.ToLower()}; foreach (var ul in upperLowerWords) { Console.WriteLine("Uppercase: {0}, Lowercase: {1}", ul.Upper, ul.Lower); } } Result Uppercase: APPLE, Lowercase: apple Uppercase: BLUEBERRY, Lowercase: blueberry Uppercase: CHERRY, Lowercase: cherry

Select - Anonymous Types 2


This sample iterates over each element of an input integer array to print the element's name and whether the element is odd or even. The sample uses select to produce a sequence of a new anonymous type. The anonymous type has two members, Digit and Even, that contain the text for the number and whether it is even, respectively. public void Linq10() { int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; string[] strings = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" }; var digitOddEvens = from n in numbers select new {Digit = strings[n], Even = (n % 2 == 0)}; foreach (var d in digitOddEvens) { Console.WriteLine("The digit {0} is {1}.", d.Digit, d.Even ? "even" : "odd"); } } Result The digit five is odd. The digit four is even. The digit one is odd.

The digit three is odd. The digit nine is odd. The digit eight is even. The digit six is even. The digit seven is odd. The digit two is even. The digit zero is even.

Select - Anonymous Types 3


This sample prints the name of every product in the product list along with the category of the product and its unit price. The sample uses select to create a sequence of a new anonymous type, each element of which contains the relevant properties for one of the products. The ProductName and Category properties have the same name as the Product class, while the UnitPrice member is renamed to Price. public void Linq11() { List products = GetProductList(); var productInfos = from p in products select new {p.ProductName, p.Category, Price = p.UnitPrice}; Console.WriteLine("Product Info:"); foreach (var productInfo in productInfos) { Console.WriteLine("{0} is in the category {1} and costs {2} per unit.", productInfo.ProductName, productInfo.Category, productInfo.Price); } } Result Product Info: Chai is in the category Beverages and costs 18.0000 per unit. Chang is in the category Beverages and costs 19.0000 per unit. Aniseed Syrup is in the category Condiments and costs 10.0000 per unit. Chef Anton's Cajun Seasoning is in the category Condiments and costs 22.0000 per unit. Chef Anton's Gumbo Mix is in the category Condiments and costs 21.3500 per unit. Grandma's Boysenberry Spread is in the category Condiments and costs 25.0000 per unit. Uncle Bob's Organic Dried Pears is in the category Produce and costs 30.0000 per unit. Northwoods Cranberry Sauce is in the category Condiments and costs 40.0000 per unit. Mishi Kobe Niku is in the category Meat/Poultry and costs 97.0000 per unit. Ikura is in the category Seafood and costs 31.0000 per unit. Queso Cabrales is in the category Dairy Products and costs 21.0000 per unit. Queso Manchego La Pastora is in the category Dairy Products and costs 38.0000 per unit. Konbu is in the category Seafood and costs 6.0000 per unit. Tofu is in the category Produce and costs 23.2500 per unit. Genen Shouyu is in the category Condiments and costs 15.5000 per unit. Pavlova is in the category Confections and costs 17.4500 per unit. Alice Mutton is in the category Meat/Poultry and costs 39.0000 per unit.

Carnarvon Tigers is in the category Seafood and costs 62.5000 per unit. Teatime Chocolate Biscuits is in the category Confections and costs 9.2000 per unit. Sir Rodney's Marmalade is in the category Confections and costs 81.0000 per unit. Sir Rodney's Scones is in the category Confections and costs 10.0000 per unit. Gustaf's Knckebrd is in the category Grains/Cereals and costs 21.0000 per unit. Tunnbrd is in the category Grains/Cereals and costs 9.0000 per unit. Guaran Fantstica is in the category Beverages and costs 4.5000 per unit. NuNuCa Nu-Nougat-Creme is in the category Confections and costs 14.0000 per unit. Gumbr Gummibrchen is in the category Confections and costs 31.2300 per unit. Schoggi Schokolade is in the category Confections and costs 43.9000 per unit. Rssle Sauerkraut is in the category Produce and costs 45.6000 per unit. Thringer Rostbratwurst is in the category Meat/Poultry and costs 123.7900 per unit. Nord-Ost Matjeshering is in the category Seafood and costs 25.8900 per unit. Gorgonzola Telino is in the category Dairy Products and costs 12.5000 per unit. Mascarpone Fabioli is in the category Dairy Products and costs 32.0000 per unit. Geitost is in the category Dairy Products and costs 2.5000 per unit. Sasquatch Ale is in the category Beverages and costs 14.0000 per unit. Steeleye Stout is in the category Beverages and costs 18.0000 per unit. Inlagd Sill is in the category Seafood and costs 19.0000 per unit. Gravad lax is in the category Seafood and costs 26.0000 per unit. Cte de Blaye is in the category Beverages and costs 263.5000 per unit. Chartreuse verte is in the category Beverages and costs 18.0000 per unit. Boston Crab Meat is in the category Seafood and costs 18.4000 per unit. Jack's New England Clam Chowder is in the category Seafood and costs 9.6500 per unit. Singaporean Hokkien Fried Mee is in the category Grains/Cereals and costs 14.0000 per unit. Ipoh Coffee is in the category Beverages and costs 46.0000 per unit. Gula Malacca is in the category Condiments and costs 19.4500 per unit. Rogede sild is in the category Seafood and costs 9.5000 per unit. Spegesild is in the category Seafood and costs 12.0000 per unit. Zaanse koeken is in the category Confections and costs 9.5000 per unit. Chocolade is in the category Confections and costs 12.7500 per unit. Maxilaku is in the category Confections and costs 20.0000 per unit. Valkoinen suklaa is in the category Confections and costs 16.2500 per unit. Manjimup Dried Apples is in the category Produce and costs 53.0000 per unit. Filo Mix is in the category Grains/Cereals and costs 7.0000 per unit. Perth Pasties is in the category Meat/Poultry and costs 32.8000 per unit. Tourtire is in the category Meat/Poultry and costs 7.4500 per unit. Pt chinois is in the category Meat/Poultry and costs 24.0000 per unit. Gnocchi di nonna Alice is in the category Grains/Cereals and costs 38.0000 per unit. Ravioli Angelo is in the category Grains/Cereals and costs 19.5000 per unit. Escargots de Bourgogne is in the category Seafood and costs 13.2500 per unit. Raclette Courdavault is in the category Dairy Products and costs 55.0000 per unit. Camembert Pierrot is in the category Dairy Products and costs 34.0000 per unit. Sirop d'rable is in the category Condiments and costs 28.5000 per unit. Tarte au sucre is in the category Confections and costs 49.3000 per unit. Vegie-spread is in the category Condiments and costs 43.9000 per unit. Wimmers gute Semmelkndel is in the category Grains/Cereals and costs 33.2500 per unit.

Louisiana Fiery Hot Pepper Sauce is in the category Condiments and costs 21.0500 per unit. Louisiana Hot Spiced Okra is in the category Condiments and costs 17.0000 per unit. Laughing Lumberjack Lager is in the category Beverages and costs 14.0000 per unit. Scottish Longbreads is in the category Confections and costs 12.5000 per unit. Gudbrandsdalsost is in the category Dairy Products and costs 36.0000 per unit. Outback Lager is in the category Beverages and costs 15.0000 per unit. Flotemysost is in the category Dairy Products and costs 21.5000 per unit. Mozzarella di Giovanni is in the category Dairy Products and costs 34.8000 per unit. Rd Kaviar is in the category Seafood and costs 15.0000 per unit. Longlife Tofu is in the category Produce and costs 10.0000 per unit. Rhnbru Klosterbier is in the category Beverages and costs 7.7500 per unit. Lakkalikri is in the category Beverages and costs 18.0000 per unit. Original Frankfurter grne Soe is in the category Condiments and costs 13.0000 per unit.

Select - Indexed
For each element in an input integer array, this sample prints the value of the integer and whether it matches its index in the array. The sample uses an indexed Select clause to create a sequence of an anonymous type, each element of which has two properties: the number itself, and a boolean value to indicate whether the number matches its position. public void Linq12() { int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; var numsInPlace = numbers.Select((num, index) => new {Num = num, InPlace = (num == index)}); Console.WriteLine("Number: In-place?"); foreach (var n in numsInPlace) { Console.WriteLine("{0}: {1}", n.Num, n.InPlace); } } Result Number: In-place? 5: False 4: False 1: False 3: True 9: False 8: False 6: True 7: True 2: False 0: False

Select - Filtered

This sample prints the name of each element of an integer array that is less than 5. The sample combines select and where to make a simple query that indexes into a string array that contains the names. public void Linq13() { int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; string[] digits = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" }; var lowNums = from n in numbers where n < 5 select digits[n]; Console.WriteLine("Numbers < 5:"); foreach (var num in lowNums) { Console.WriteLine(num); } } Result Numbers < 5: four one three two zero

SelectMany - Compound from 1


This sample identifies ordered pairs of integers, such that the first number is an alement of one integer array and the second number is an element of another integer array, and the first number is less than the second. The sample uses a compound from clause to compose a query that returns a sequence of the pairs. public void Linq14() { int[] numbersA = { 0, 2, 4, 5, 6, 8, 9 }; int[] numbersB = { 1, 3, 5, 7, 8 }; var pairs = from a in numbersA, b in numbersB where a < b select new {a, b}; Console.WriteLine("Pairs where a < b:"); foreach (var pair in pairs) { Console.WriteLine("{0} is less than {1}", pair.a, pair.b); } } Result

Pairs where a < b: 0 is less than 1 0 is less than 3 0 is less than 5 0 is less than 7 0 is less than 8 2 is less than 3 2 is less than 5 2 is less than 7 2 is less than 8 4 is less than 5 4 is less than 7 4 is less than 8 5 is less than 7 5 is less than 8 6 is less than 7 6 is less than 8

SelectMany - Compound from 2


This sample prints all orders whose total is less that 500. The sample uses a compound from clause and selects fields from the customer and order classes. public void Linq15() { List customers = GetCustomerList(); var orders = from c in customers, o in c.Orders where o.Total < 500.00M select new {c.CustomerID, o.OrderID, o.Total}; ObjectDumper.Write(orders); } Result CustomerID=ALFKI OrderID=10702 Total=330.00 CustomerID=ALFKI OrderID=10952 Total=471.20 CustomerID=ANATR OrderID=10308 Total=88.80 CustomerID=ANATR OrderID=10625 Total=479.75 CustomerID=ANATR OrderID=10759 Total=320.00 CustomerID=ANTON OrderID=10365 Total=403.20 CustomerID=ANTON OrderID=10682 Total=375.50 CustomerID=AROUT OrderID=10355 Total=480.00 CustomerID=AROUT OrderID=10453 Total=407.70 CustomerID=AROUT OrderID=10741 Total=228.00 CustomerID=AROUT OrderID=10743 Total=319.20 CustomerID=AROUT OrderID=10793 Total=191.10

CustomerID=AROUT OrderID=10864 Total=282.00 CustomerID=AROUT OrderID=10920 Total=390.00 CustomerID=AROUT OrderID=11016 Total=491.50 CustomerID=BERGS OrderID=10445 Total=174.90 CustomerID=BERGS OrderID=10689 Total=472.50 CustomerID=BERGS OrderID=10778 Total=96.50 CustomerID=BLAUS OrderID=10501 Total=149.00 CustomerID=BLAUS OrderID=10509 Total=136.80 CustomerID=BLAUS OrderID=10582 Total=330.00 CustomerID=BLAUS OrderID=10614 Total=464.00 CustomerID=BLONP OrderID=10628 Total=450.00 CustomerID=BOLID OrderID=10970 Total=224.00 CustomerID=BONAP OrderID=10331 Total=88.50 CustomerID=BONAP OrderID=10730 Total=484.26 CustomerID=BONAP OrderID=10732 Total=360.00 CustomerID=BONAP OrderID=10940 Total=360.00 CustomerID=BSBEV OrderID=10289 Total=479.40 CustomerID=BSBEV OrderID=10484 Total=386.20 CustomerID=BSBEV OrderID=10538 Total=139.80 CustomerID=BSBEV OrderID=10539 Total=355.50 CustomerID=BSBEV OrderID=10578 Total=477.00 CustomerID=BSBEV OrderID=10599 Total=493.00 CustomerID=BSBEV OrderID=10947 Total=220.00 CustomerID=CACTU OrderID=10521 Total=225.50 CustomerID=CACTU OrderID=10782 Total=12.50 CustomerID=CACTU OrderID=10819 Total=477.00 CustomerID=CACTU OrderID=10881 Total=150.00 CustomerID=CACTU OrderID=11054 Total=305.00 CustomerID=CENTC OrderID=10259 Total=100.80 CustomerID=COMMI OrderID=10466 Total=216.00 CustomerID=COMMI OrderID=10969 Total=108.00 CustomerID=COMMI OrderID=11042 Total=405.75 CustomerID=CONSH OrderID=10462 Total=156.00 CustomerID=DRACD OrderID=10363 Total=447.20 CustomerID=DRACD OrderID=10391 Total=86.40 CustomerID=DRACD OrderID=10797 Total=420.00 CustomerID=DRACD OrderID=11067 Total=86.85 CustomerID=DUMON OrderID=10311 Total=268.80 CustomerID=DUMON OrderID=10609 Total=424.00 CustomerID=DUMON OrderID=10683 Total=63.00 CustomerID=ERNSH OrderID=10771 Total=344.00 CustomerID=FAMIA OrderID=10386 Total=166.00 CustomerID=FAMIA OrderID=10414 Total=224.83 CustomerID=FAMIA OrderID=10581 Total=310.00 CustomerID=FAMIA OrderID=10725 Total=287.80 CustomerID=FOLKO OrderID=10378 Total=103.20 CustomerID=FOLKO OrderID=10434 Total=321.12

CustomerID=FOLKO OrderID=10460 Total=176.10 CustomerID=FOLKO OrderID=10824 Total=250.80 CustomerID=FOLKO OrderID=10955 Total=74.40 CustomerID=FOLKO OrderID=10980 Total=248.00 CustomerID=FRANS OrderID=10422 Total=49.80 CustomerID=FRANS OrderID=10710 Total=93.50 CustomerID=FRANS OrderID=10753 Total=88.00 CustomerID=FRANS OrderID=10807 Total=18.40 CustomerID=FRANS OrderID=11060 Total=266.00 CustomerID=FURIB OrderID=10352 Total=136.30 CustomerID=FURIB OrderID=10491 Total=259.50 CustomerID=FURIB OrderID=10604 Total=230.85 CustomerID=FURIB OrderID=10963 Total=57.80 CustomerID=GALED OrderID=10366 Total=136.00 CustomerID=GALED OrderID=10426 Total=338.20 CustomerID=GALED OrderID=10568 Total=155.00 CustomerID=GALED OrderID=10887 Total=70.00 CustomerID=GALED OrderID=10928 Total=137.50 CustomerID=GODOS OrderID=10874 Total=310.00 CustomerID=GODOS OrderID=11037 Total=60.00 CustomerID=GOURL OrderID=10652 Total=318.84 CustomerID=GOURL OrderID=10777 Total=224.00 CustomerID=GOURL OrderID=10959 Total=131.75 CustomerID=GOURL OrderID=11049 Total=273.60 CustomerID=GREAL OrderID=10528 Total=392.20 CustomerID=GREAL OrderID=10589 Total=72.00 CustomerID=GREAL OrderID=10936 Total=456.00 CustomerID=GREAL OrderID=11006 Total=329.68 CustomerID=GREAL OrderID=11040 Total=200.00 CustomerID=GROSR OrderID=10785 Total=387.50 CustomerID=HANAR OrderID=10770 Total=236.25 CustomerID=HANAR OrderID=10925 Total=475.15 CustomerID=HILAA OrderID=10476 Total=180.48 CustomerID=HILAA OrderID=10613 Total=353.20 CustomerID=HILAA OrderID=10705 Total=378.00 CustomerID=HILAA OrderID=10863 Total=441.15 CustomerID=HILAA OrderID=10960 Total=265.35 CustomerID=HUNGC OrderID=10375 Total=338.00 CustomerID=HUNGC OrderID=10394 Total=442.00 CustomerID=HUNGC OrderID=10415 Total=102.40 CustomerID=HUNGC OrderID=10600 Total=479.80 CustomerID=ISLAT OrderID=10318 Total=240.40 CustomerID=ISLAT OrderID=10321 Total=144.00 CustomerID=ISLAT OrderID=10473 Total=230.40 CustomerID=ISLAT OrderID=10674 Total=45.00 CustomerID=ISLAT OrderID=10798 Total=446.60 CustomerID=KOENE OrderID=10323 Total=164.40

CustomerID=KOENE OrderID=10506 Total=415.80 CustomerID=KOENE OrderID=10542 Total=469.11 CustomerID=LACOR OrderID=10972 Total=251.50 CustomerID=LACOR OrderID=10973 Total=291.55 CustomerID=LAMAI OrderID=10358 Total=429.40 CustomerID=LAMAI OrderID=10371 Total=72.96 CustomerID=LAMAI OrderID=10425 Total=360.00 CustomerID=LAMAI OrderID=10454 Total=331.20 CustomerID=LAMAI OrderID=10610 Total=299.25 CustomerID=LAMAI OrderID=10631 Total=55.80 CustomerID=LAMAI OrderID=10832 Total=475.11 CustomerID=LAMAI OrderID=11051 Total=36.00 CustomerID=LAUGB OrderID=10495 Total=278.00 CustomerID=LAUGB OrderID=10620 Total=57.50 CustomerID=LAUGB OrderID=10810 Total=187.00 CustomerID=LAZYK OrderID=10482 Total=147.00 CustomerID=LAZYK OrderID=10545 Total=210.00 CustomerID=LEHMS OrderID=10279 Total=351.00 CustomerID=LEHMS OrderID=10534 Total=465.70 CustomerID=LEHMS OrderID=10891 Total=368.93 CustomerID=LETSS OrderID=10579 Total=317.75 CustomerID=LILAS OrderID=10381 Total=112.00 CustomerID=LILAS OrderID=10899 Total=122.40 CustomerID=LILAS OrderID=11065 Total=189.42 CustomerID=LILAS OrderID=11071 Total=484.50 CustomerID=LINOD OrderID=10405 Total=400.00 CustomerID=LINOD OrderID=10840 Total=211.20 CustomerID=LINOD OrderID=11014 Total=243.18 CustomerID=LONEP OrderID=10307 Total=424.00 CustomerID=LONEP OrderID=10317 Total=288.00 CustomerID=LONEP OrderID=10544 Total=417.20 CustomerID=LONEP OrderID=10662 Total=125.00 CustomerID=LONEP OrderID=10867 Total=98.40 CustomerID=LONEP OrderID=10883 Total=36.00 CustomerID=MAGAA OrderID=10275 Total=291.84 CustomerID=MAGAA OrderID=10467 Total=235.20 CustomerID=MAGAA OrderID=10754 Total=55.20 CustomerID=MAGAA OrderID=10950 Total=110.00 CustomerID=MAISD OrderID=11004 Total=295.38 CustomerID=MEREP OrderID=10376 Total=399.00 CustomerID=MEREP OrderID=10505 Total=147.90 CustomerID=MORGK OrderID=10699 Total=114.00 CustomerID=MORGK OrderID=10945 Total=245.00 CustomerID=NORTS OrderID=10517 Total=352.00 CustomerID=NORTS OrderID=10752 Total=252.00 CustomerID=NORTS OrderID=11057 Total=45.00 CustomerID=OCEAN OrderID=10409 Total=319.20

CustomerID=OCEAN OrderID=10531 Total=110.00 CustomerID=OCEAN OrderID=10898 Total=30.00 CustomerID=OTTIK OrderID=10508 Total=240.00 CustomerID=PERIC OrderID=10322 Total=112.00 CustomerID=PERIC OrderID=11073 Total=300.00 CustomerID=PICCO OrderID=10489 Total=439.20 CustomerID=PRINI OrderID=10336 Total=285.12 CustomerID=QUEDE OrderID=10261 Total=448.00 CustomerID=QUEDE OrderID=10291 Total=497.52 CustomerID=QUEDE OrderID=10794 Total=314.76 CustomerID=QUICK OrderID=10313 Total=182.40 CustomerID=RANCH OrderID=10448 Total=443.40 CustomerID=RANCH OrderID=11019 Total=76.00 CustomerID=REGGC OrderID=10288 Total=80.10 CustomerID=REGGC OrderID=10428 Total=192.00 CustomerID=REGGC OrderID=10562 Total=488.70 CustomerID=REGGC OrderID=10586 Total=23.80 CustomerID=REGGC OrderID=10655 Total=154.40 CustomerID=REGGC OrderID=11062 Total=406.40 CustomerID=RICAR OrderID=10299 Total=349.50 CustomerID=RICAR OrderID=10648 Total=372.38 CustomerID=RICSU OrderID=10951 Total=458.76 CustomerID=RICSU OrderID=11075 Total=498.10 CustomerID=ROMEY OrderID=10281 Total=86.50 CustomerID=ROMEY OrderID=10282 Total=155.40 CustomerID=ROMEY OrderID=10306 Total=498.50 CustomerID=ROMEY OrderID=10917 Total=365.89 CustomerID=ROMEY OrderID=11013 Total=361.00 CustomerID=SANTG OrderID=10520 Total=200.00 CustomerID=SAVEA OrderID=10815 Total=40.00 CustomerID=SIMOB OrderID=10341 Total=352.60 CustomerID=SIMOB OrderID=11074 Total=232.08 CustomerID=SPECD OrderID=10738 Total=52.35 CustomerID=SPECD OrderID=10907 Total=108.50 CustomerID=SPECD OrderID=11043 Total=210.00 CustomerID=SPLIR OrderID=10271 Total=48.00 CustomerID=SPLIR OrderID=10349 Total=141.60 CustomerID=SPLIR OrderID=10432 Total=485.00 CustomerID=SPLIR OrderID=10974 Total=439.00 CustomerID=SUPRD OrderID=10767 Total=28.00 CustomerID=THEBI OrderID=10310 Total=336.00 CustomerID=THEBI OrderID=10708 Total=180.40 CustomerID=THEBI OrderID=10992 Total=69.60 CustomerID=THECR OrderID=10775 Total=228.00 CustomerID=THECR OrderID=11003 Total=326.00 CustomerID=TOMSP OrderID=10438 Total=454.00 CustomerID=TOMSP OrderID=10446 Total=246.24

CustomerID=TOMSP OrderID=10548 Total=240.10 CustomerID=TORTU OrderID=10276 Total=420.00 CustomerID=TORTU OrderID=11069 Total=360.00 CustomerID=TRADH OrderID=10496 Total=190.00 CustomerID=TRAIH OrderID=10822 Total=237.90 CustomerID=VAFFE OrderID=10602 Total=48.75 CustomerID=VICTE OrderID=10334 Total=144.80 CustomerID=VICTE OrderID=10450 Total=425.12 CustomerID=VICTE OrderID=10478 Total=471.20 CustomerID=VICTE OrderID=10806 Total=439.60 CustomerID=VICTE OrderID=10843 Total=159.00 CustomerID=VINET OrderID=10295 Total=121.60 CustomerID=VINET OrderID=10737 Total=139.80 CustomerID=VINET OrderID=10739 Total=240.00 CustomerID=WANDK OrderID=10348 Total=363.60 CustomerID=WANDK OrderID=10651 Total=397.80 CustomerID=WARTH OrderID=10266 Total=346.56 CustomerID=WARTH OrderID=10412 Total=334.80 CustomerID=WARTH OrderID=10437 Total=393.00 CustomerID=WARTH OrderID=11025 Total=270.00 CustomerID=WELLI OrderID=10585 Total=142.50 CustomerID=WELLI OrderID=10809 Total=140.00 CustomerID=WELLI OrderID=10900 Total=33.75 CustomerID=WELLI OrderID=10905 Total=342.00 CustomerID=WHITC OrderID=10723 Total=468.45 CustomerID=WILMK OrderID=10248 Total=440.00 CustomerID=WILMK OrderID=10615 Total=120.00 CustomerID=WILMK OrderID=10673 Total=412.35 CustomerID=WILMK OrderID=10873 Total=336.80 CustomerID=WILMK OrderID=10910 Total=452.90 CustomerID=WOLZA OrderID=10374 Total=459.00 CustomerID=WOLZA OrderID=10792 Total=399.85 CustomerID=WOLZA OrderID=10870 Total=160.00 CustomerID=WOLZA OrderID=10906 Total=427.50

SelectMany - Compound from 3


This sample uses a compound from clause to select all orders where the order was made in 1998 or later. public void Linq16() { List customers = GetCustomerList(); var orders = from c in customers, o in c.Orders where o.OrderDate >= new DateTime(1998, 1, 1) select new {c.CustomerID, o.OrderID, o.OrderDate};

ObjectDumper.Write(orders); } Result CustomerID=ALFKI OrderID=10835 OrderDate=1/15/1998 CustomerID=ALFKI OrderID=10952 OrderDate=3/16/1998 CustomerID=ALFKI OrderID=11011 OrderDate=4/9/1998 CustomerID=ANATR OrderID=10926 OrderDate=3/4/1998 CustomerID=ANTON OrderID=10856 OrderDate=1/28/1998 CustomerID=AROUT OrderID=10864 OrderDate=2/2/1998 CustomerID=AROUT OrderID=10920 OrderDate=3/3/1998 CustomerID=AROUT OrderID=10953 OrderDate=3/16/1998 CustomerID=AROUT OrderID=11016 OrderDate=4/10/1998 CustomerID=BERGS OrderID=10837 OrderDate=1/16/1998 CustomerID=BERGS OrderID=10857 OrderDate=1/28/1998 CustomerID=BERGS OrderID=10866 OrderDate=2/3/1998 CustomerID=BERGS OrderID=10875 OrderDate=2/6/1998 CustomerID=BERGS OrderID=10924 OrderDate=3/4/1998 CustomerID=BLAUS OrderID=10853 OrderDate=1/27/1998 CustomerID=BLAUS OrderID=10956 OrderDate=3/17/1998 CustomerID=BLAUS OrderID=11058 OrderDate=4/29/1998 CustomerID=BLONP OrderID=10826 OrderDate=1/12/1998 CustomerID=BOLID OrderID=10970 OrderDate=3/24/1998 CustomerID=BONAP OrderID=10827 OrderDate=1/12/1998 CustomerID=BONAP OrderID=10871 OrderDate=2/5/1998 CustomerID=BONAP OrderID=10876 OrderDate=2/9/1998 CustomerID=BONAP OrderID=10932 OrderDate=3/6/1998 CustomerID=BONAP OrderID=10940 OrderDate=3/11/1998 CustomerID=BONAP OrderID=11076 OrderDate=5/6/1998 CustomerID=BOTTM OrderID=10918 OrderDate=3/2/1998 CustomerID=BOTTM OrderID=10944 OrderDate=3/12/1998 CustomerID=BOTTM OrderID=10949 OrderDate=3/13/1998 CustomerID=BOTTM OrderID=10975 OrderDate=3/25/1998 CustomerID=BOTTM OrderID=10982 OrderDate=3/27/1998 CustomerID=BOTTM OrderID=11027 OrderDate=4/16/1998 CustomerID=BOTTM OrderID=11045 OrderDate=4/23/1998 CustomerID=BOTTM OrderID=11048 OrderDate=4/24/1998 CustomerID=BSBEV OrderID=10943 OrderDate=3/11/1998 CustomerID=BSBEV OrderID=10947 OrderDate=3/13/1998 CustomerID=BSBEV OrderID=11023 OrderDate=4/14/1998 CustomerID=CACTU OrderID=10819 OrderDate=1/7/1998 CustomerID=CACTU OrderID=10881 OrderDate=2/11/1998 CustomerID=CACTU OrderID=10937 OrderDate=3/10/1998 CustomerID=CACTU OrderID=11054 OrderDate=4/28/1998 CustomerID=CHOPS OrderID=10966 OrderDate=3/20/1998 CustomerID=CHOPS OrderID=11029 OrderDate=4/16/1998 CustomerID=CHOPS OrderID=11041 OrderDate=4/22/1998

CustomerID=COMMI OrderID=10969 OrderDate=3/23/1998 CustomerID=COMMI OrderID=11042 OrderDate=4/22/1998 CustomerID=CONSH OrderID=10848 OrderDate=1/23/1998 CustomerID=DRACD OrderID=10825 OrderDate=1/9/1998 CustomerID=DRACD OrderID=11036 OrderDate=4/20/1998 CustomerID=DRACD OrderID=11067 OrderDate=5/4/1998 CustomerID=DUMON OrderID=10890 OrderDate=2/16/1998 CustomerID=EASTC OrderID=10987 OrderDate=3/31/1998 CustomerID=EASTC OrderID=11024 OrderDate=4/15/1998 CustomerID=EASTC OrderID=11047 OrderDate=4/24/1998 CustomerID=EASTC OrderID=11056 OrderDate=4/28/1998 CustomerID=ERNSH OrderID=10836 OrderDate=1/16/1998 CustomerID=ERNSH OrderID=10854 OrderDate=1/27/1998 CustomerID=ERNSH OrderID=10895 OrderDate=2/18/1998 CustomerID=ERNSH OrderID=10968 OrderDate=3/23/1998 CustomerID=ERNSH OrderID=10979 OrderDate=3/26/1998 CustomerID=ERNSH OrderID=10990 OrderDate=4/1/1998 CustomerID=ERNSH OrderID=11008 OrderDate=4/8/1998 CustomerID=ERNSH OrderID=11017 OrderDate=4/13/1998 CustomerID=ERNSH OrderID=11072 OrderDate=5/5/1998 CustomerID=FOLKO OrderID=10824 OrderDate=1/9/1998 CustomerID=FOLKO OrderID=10880 OrderDate=2/10/1998 CustomerID=FOLKO OrderID=10902 OrderDate=2/23/1998 CustomerID=FOLKO OrderID=10955 OrderDate=3/17/1998 CustomerID=FOLKO OrderID=10977 OrderDate=3/26/1998 CustomerID=FOLKO OrderID=10980 OrderDate=3/27/1998 CustomerID=FOLKO OrderID=10993 OrderDate=4/1/1998 CustomerID=FOLKO OrderID=11001 OrderDate=4/6/1998 CustomerID=FOLKO OrderID=11050 OrderDate=4/27/1998 CustomerID=FRANK OrderID=10859 OrderDate=1/29/1998 CustomerID=FRANK OrderID=10929 OrderDate=3/5/1998 CustomerID=FRANK OrderID=11012 OrderDate=4/9/1998 CustomerID=FRANR OrderID=10860 OrderDate=1/29/1998 CustomerID=FRANR OrderID=10971 OrderDate=3/24/1998 CustomerID=FRANS OrderID=11026 OrderDate=4/15/1998 CustomerID=FRANS OrderID=11060 OrderDate=4/30/1998 CustomerID=FURIB OrderID=10963 OrderDate=3/19/1998 CustomerID=GALED OrderID=10887 OrderDate=2/13/1998 CustomerID=GALED OrderID=10928 OrderDate=3/5/1998 CustomerID=GODOS OrderID=10872 OrderDate=2/5/1998 CustomerID=GODOS OrderID=10874 OrderDate=2/6/1998 CustomerID=GODOS OrderID=10888 OrderDate=2/16/1998 CustomerID=GODOS OrderID=10911 OrderDate=2/26/1998 CustomerID=GODOS OrderID=10948 OrderDate=3/13/1998 CustomerID=GODOS OrderID=11009 OrderDate=4/8/1998 CustomerID=GODOS OrderID=11037 OrderDate=4/21/1998 CustomerID=GOURL OrderID=10959 OrderDate=3/18/1998

CustomerID=GOURL OrderID=11049 OrderDate=4/24/1998 CustomerID=GREAL OrderID=10816 OrderDate=1/6/1998 CustomerID=GREAL OrderID=10936 OrderDate=3/9/1998 CustomerID=GREAL OrderID=11006 OrderDate=4/7/1998 CustomerID=GREAL OrderID=11040 OrderDate=4/22/1998 CustomerID=GREAL OrderID=11061 OrderDate=4/30/1998 CustomerID=HANAR OrderID=10886 OrderDate=2/13/1998 CustomerID=HANAR OrderID=10903 OrderDate=2/24/1998 CustomerID=HANAR OrderID=10922 OrderDate=3/3/1998 CustomerID=HANAR OrderID=10925 OrderDate=3/4/1998 CustomerID=HANAR OrderID=10981 OrderDate=3/27/1998 CustomerID=HANAR OrderID=11022 OrderDate=4/14/1998 CustomerID=HANAR OrderID=11052 OrderDate=4/27/1998 CustomerID=HILAA OrderID=10863 OrderDate=2/2/1998 CustomerID=HILAA OrderID=10901 OrderDate=2/23/1998 CustomerID=HILAA OrderID=10957 OrderDate=3/18/1998 CustomerID=HILAA OrderID=10960 OrderDate=3/19/1998 CustomerID=HILAA OrderID=10976 OrderDate=3/25/1998 CustomerID=HILAA OrderID=11055 OrderDate=4/28/1998 CustomerID=HUNGO OrderID=10897 OrderDate=2/19/1998 CustomerID=HUNGO OrderID=10912 OrderDate=2/26/1998 CustomerID=HUNGO OrderID=10985 OrderDate=3/30/1998 CustomerID=HUNGO OrderID=11063 OrderDate=4/30/1998 CustomerID=ISLAT OrderID=10829 OrderDate=1/13/1998 CustomerID=ISLAT OrderID=10933 OrderDate=3/6/1998 CustomerID=KOENE OrderID=10817 OrderDate=1/6/1998 CustomerID=KOENE OrderID=10849 OrderDate=1/23/1998 CustomerID=KOENE OrderID=10893 OrderDate=2/18/1998 CustomerID=KOENE OrderID=11028 OrderDate=4/16/1998 CustomerID=LACOR OrderID=10858 OrderDate=1/29/1998 CustomerID=LACOR OrderID=10927 OrderDate=3/5/1998 CustomerID=LACOR OrderID=10972 OrderDate=3/24/1998 CustomerID=LACOR OrderID=10973 OrderDate=3/24/1998 CustomerID=LAMAI OrderID=10832 OrderDate=1/14/1998 CustomerID=LAMAI OrderID=10923 OrderDate=3/3/1998 CustomerID=LAMAI OrderID=11051 OrderDate=4/27/1998 CustomerID=LAUGB OrderID=10810 OrderDate=1/1/1998 CustomerID=LEHMS OrderID=10862 OrderDate=1/30/1998 CustomerID=LEHMS OrderID=10891 OrderDate=2/17/1998 CustomerID=LEHMS OrderID=10934 OrderDate=3/9/1998 CustomerID=LEHMS OrderID=11070 OrderDate=5/5/1998 CustomerID=LETSS OrderID=10884 OrderDate=2/12/1998 CustomerID=LILAS OrderID=10823 OrderDate=1/9/1998 CustomerID=LILAS OrderID=10899 OrderDate=2/20/1998 CustomerID=LILAS OrderID=10997 OrderDate=4/3/1998 CustomerID=LILAS OrderID=11065 OrderDate=5/1/1998 CustomerID=LILAS OrderID=11071 OrderDate=5/5/1998

CustomerID=LINOD OrderID=10811 OrderDate=1/2/1998 CustomerID=LINOD OrderID=10838 OrderDate=1/19/1998 CustomerID=LINOD OrderID=10840 OrderDate=1/19/1998 CustomerID=LINOD OrderID=10919 OrderDate=3/2/1998 CustomerID=LINOD OrderID=10954 OrderDate=3/17/1998 CustomerID=LINOD OrderID=11014 OrderDate=4/10/1998 CustomerID=LINOD OrderID=11039 OrderDate=4/21/1998 CustomerID=LONEP OrderID=10867 OrderDate=2/3/1998 CustomerID=LONEP OrderID=10883 OrderDate=2/12/1998 CustomerID=LONEP OrderID=11018 OrderDate=4/13/1998 CustomerID=MAGAA OrderID=10818 OrderDate=1/7/1998 CustomerID=MAGAA OrderID=10939 OrderDate=3/10/1998 CustomerID=MAGAA OrderID=10950 OrderDate=3/16/1998 CustomerID=MAISD OrderID=10892 OrderDate=2/17/1998 CustomerID=MAISD OrderID=10896 OrderDate=2/19/1998 CustomerID=MAISD OrderID=10978 OrderDate=3/26/1998 CustomerID=MAISD OrderID=11004 OrderDate=4/7/1998 CustomerID=MORGK OrderID=10945 OrderDate=3/12/1998 CustomerID=NORTS OrderID=11057 OrderDate=4/29/1998 CustomerID=OCEAN OrderID=10898 OrderDate=2/20/1998 CustomerID=OCEAN OrderID=10958 OrderDate=3/18/1998 CustomerID=OCEAN OrderID=10986 OrderDate=3/30/1998 CustomerID=OLDWO OrderID=10855 OrderDate=1/27/1998 CustomerID=OLDWO OrderID=10965 OrderDate=3/20/1998 CustomerID=OLDWO OrderID=11034 OrderDate=4/20/1998 CustomerID=OTTIK OrderID=10833 OrderDate=1/15/1998 CustomerID=OTTIK OrderID=10999 OrderDate=4/3/1998 CustomerID=OTTIK OrderID=11020 OrderDate=4/14/1998 CustomerID=PERIC OrderID=10995 OrderDate=4/2/1998 CustomerID=PERIC OrderID=11073 OrderDate=5/5/1998 CustomerID=PICCO OrderID=10844 OrderDate=1/21/1998 CustomerID=PICCO OrderID=11053 OrderDate=4/27/1998 CustomerID=PRINI OrderID=10808 OrderDate=1/1/1998 CustomerID=PRINI OrderID=11007 OrderDate=4/8/1998 CustomerID=QUEDE OrderID=10989 OrderDate=3/31/1998 CustomerID=QUEEN OrderID=10868 OrderDate=2/4/1998 CustomerID=QUEEN OrderID=10913 OrderDate=2/26/1998 CustomerID=QUEEN OrderID=10914 OrderDate=2/27/1998 CustomerID=QUEEN OrderID=10961 OrderDate=3/19/1998 CustomerID=QUEEN OrderID=11068 OrderDate=5/4/1998 CustomerID=QUICK OrderID=10845 OrderDate=1/21/1998 CustomerID=QUICK OrderID=10865 OrderDate=2/2/1998 CustomerID=QUICK OrderID=10878 OrderDate=2/10/1998 CustomerID=QUICK OrderID=10938 OrderDate=3/10/1998 CustomerID=QUICK OrderID=10962 OrderDate=3/19/1998 CustomerID=QUICK OrderID=10991 OrderDate=4/1/1998 CustomerID=QUICK OrderID=10996 OrderDate=4/2/1998

CustomerID=QUICK OrderID=11021 OrderDate=4/14/1998 CustomerID=RANCH OrderID=10828 OrderDate=1/13/1998 CustomerID=RANCH OrderID=10916 OrderDate=2/27/1998 CustomerID=RANCH OrderID=11019 OrderDate=4/13/1998 CustomerID=RATTC OrderID=10820 OrderDate=1/7/1998 CustomerID=RATTC OrderID=10852 OrderDate=1/26/1998 CustomerID=RATTC OrderID=10889 OrderDate=2/16/1998 CustomerID=RATTC OrderID=10988 OrderDate=3/31/1998 CustomerID=RATTC OrderID=11000 OrderDate=4/6/1998 CustomerID=RATTC OrderID=11077 OrderDate=5/6/1998 CustomerID=REGGC OrderID=10812 OrderDate=1/2/1998 CustomerID=REGGC OrderID=10908 OrderDate=2/26/1998 CustomerID=REGGC OrderID=10942 OrderDate=3/11/1998 CustomerID=REGGC OrderID=11010 OrderDate=4/9/1998 CustomerID=REGGC OrderID=11062 OrderDate=4/30/1998 CustomerID=RICAR OrderID=10813 OrderDate=1/5/1998 CustomerID=RICAR OrderID=10851 OrderDate=1/26/1998 CustomerID=RICAR OrderID=10877 OrderDate=2/9/1998 CustomerID=RICAR OrderID=11059 OrderDate=4/29/1998 CustomerID=RICSU OrderID=10931 OrderDate=3/6/1998 CustomerID=RICSU OrderID=10951 OrderDate=3/16/1998 CustomerID=RICSU OrderID=11033 OrderDate=4/17/1998 CustomerID=RICSU OrderID=11075 OrderDate=5/6/1998 CustomerID=ROMEY OrderID=10917 OrderDate=3/2/1998 CustomerID=ROMEY OrderID=11013 OrderDate=4/9/1998 CustomerID=SANTG OrderID=10831 OrderDate=1/14/1998 CustomerID=SANTG OrderID=10909 OrderDate=2/26/1998 CustomerID=SANTG OrderID=11015 OrderDate=4/10/1998 CustomerID=SAVEA OrderID=10815 OrderDate=1/5/1998 CustomerID=SAVEA OrderID=10847 OrderDate=1/22/1998 CustomerID=SAVEA OrderID=10882 OrderDate=2/11/1998 CustomerID=SAVEA OrderID=10894 OrderDate=2/18/1998 CustomerID=SAVEA OrderID=10941 OrderDate=3/11/1998 CustomerID=SAVEA OrderID=10983 OrderDate=3/27/1998 CustomerID=SAVEA OrderID=10984 OrderDate=3/30/1998 CustomerID=SAVEA OrderID=11002 OrderDate=4/6/1998 CustomerID=SAVEA OrderID=11030 OrderDate=4/17/1998 CustomerID=SAVEA OrderID=11031 OrderDate=4/17/1998 CustomerID=SAVEA OrderID=11064 OrderDate=5/1/1998 CustomerID=SEVES OrderID=10869 OrderDate=2/4/1998 CustomerID=SIMOB OrderID=11074 OrderDate=5/6/1998 CustomerID=SPECD OrderID=10907 OrderDate=2/25/1998 CustomerID=SPECD OrderID=10964 OrderDate=3/20/1998 CustomerID=SPECD OrderID=11043 OrderDate=4/22/1998 CustomerID=SPLIR OrderID=10821 OrderDate=1/8/1998 CustomerID=SPLIR OrderID=10974 OrderDate=3/25/1998 CustomerID=SUPRD OrderID=10841 OrderDate=1/20/1998

CustomerID=SUPRD OrderID=10846 OrderDate=1/22/1998 CustomerID=SUPRD OrderID=10885 OrderDate=2/12/1998 CustomerID=SUPRD OrderID=10930 OrderDate=3/6/1998 CustomerID=SUPRD OrderID=11035 OrderDate=4/20/1998 CustomerID=SUPRD OrderID=11038 OrderDate=4/21/1998 CustomerID=THEBI OrderID=10992 OrderDate=4/1/1998 CustomerID=THECR OrderID=11003 OrderDate=4/6/1998 CustomerID=TOMSP OrderID=10967 OrderDate=3/23/1998 CustomerID=TORTU OrderID=10842 OrderDate=1/20/1998 CustomerID=TORTU OrderID=10915 OrderDate=2/27/1998 CustomerID=TORTU OrderID=11069 OrderDate=5/4/1998 CustomerID=TRADH OrderID=10830 OrderDate=1/13/1998 CustomerID=TRADH OrderID=10834 OrderDate=1/15/1998 CustomerID=TRADH OrderID=10839 OrderDate=1/19/1998 CustomerID=TRAIH OrderID=10822 OrderDate=1/8/1998 CustomerID=VAFFE OrderID=10921 OrderDate=3/3/1998 CustomerID=VAFFE OrderID=10946 OrderDate=3/12/1998 CustomerID=VAFFE OrderID=10994 OrderDate=4/2/1998 CustomerID=VICTE OrderID=10814 OrderDate=1/5/1998 CustomerID=VICTE OrderID=10843 OrderDate=1/21/1998 CustomerID=VICTE OrderID=10850 OrderDate=1/23/1998 CustomerID=WANDK OrderID=11046 OrderDate=4/23/1998 CustomerID=WARTH OrderID=11025 OrderDate=4/15/1998 CustomerID=WELLI OrderID=10809 OrderDate=1/1/1998 CustomerID=WELLI OrderID=10900 OrderDate=2/20/1998 CustomerID=WELLI OrderID=10905 OrderDate=2/24/1998 CustomerID=WELLI OrderID=10935 OrderDate=3/9/1998 CustomerID=WHITC OrderID=10861 OrderDate=1/30/1998 CustomerID=WHITC OrderID=10904 OrderDate=2/24/1998 CustomerID=WHITC OrderID=11032 OrderDate=4/17/1998 CustomerID=WHITC OrderID=11066 OrderDate=5/1/1998 CustomerID=WILMK OrderID=10873 OrderDate=2/6/1998 CustomerID=WILMK OrderID=10879 OrderDate=2/10/1998 CustomerID=WILMK OrderID=10910 OrderDate=2/26/1998 CustomerID=WILMK OrderID=11005 OrderDate=4/7/1998 CustomerID=WOLZA OrderID=10870 OrderDate=2/4/1998 CustomerID=WOLZA OrderID=10906 OrderDate=2/25/1998 CustomerID=WOLZA OrderID=10998 OrderDate=4/3/1998 CustomerID=WOLZA OrderID=11044 OrderDate=4/23/1998

SelectMany - from Assignment


This sample uses a compound from clause to select all orders where the order total is greater than 2000.00 and uses from assignment to avoid requesting the total twice. public void Linq17() { List customers = GetCustomerList();

var orders = from c in customers, o in c.Orders, total = o.Total where total >= 2000.0M select new {c.CustomerID, o.OrderID, total}; ObjectDumper.Write(orders); } Result CustomerID=ANTON OrderID=10573 total=2082.00 CustomerID=AROUT OrderID=10558 total=2142.90 CustomerID=AROUT OrderID=10953 total=4441.25 CustomerID=BERGS OrderID=10384 total=2222.40 CustomerID=BERGS OrderID=10524 total=3192.65 CustomerID=BERGS OrderID=10672 total=3815.25 CustomerID=BERGS OrderID=10857 total=2048.21 CustomerID=BLONP OrderID=10360 total=7390.20 CustomerID=BOLID OrderID=10801 total=3026.85 CustomerID=BONAP OrderID=10340 total=2436.18 CustomerID=BONAP OrderID=10511 total=2550.00 CustomerID=BOTTM OrderID=10742 total=3118.00 CustomerID=BOTTM OrderID=10949 total=4422.00 CustomerID=CHOPS OrderID=10519 total=2314.20 CustomerID=CHOPS OrderID=10746 total=2311.70 CustomerID=COMMI OrderID=10290 total=2169.00 CustomerID=EASTC OrderID=10400 total=3063.00 CustomerID=EASTC OrderID=10987 total=2772.00 CustomerID=EASTC OrderID=11056 total=3740.00 CustomerID=ERNSH OrderID=10351 total=5398.72 CustomerID=ERNSH OrderID=10382 total=2900.00 CustomerID=ERNSH OrderID=10390 total=2090.88 CustomerID=ERNSH OrderID=10402 total=2713.50 CustomerID=ERNSH OrderID=10430 total=4899.20 CustomerID=ERNSH OrderID=10514 total=8623.45 CustomerID=ERNSH OrderID=10595 total=4725.00 CustomerID=ERNSH OrderID=10633 total=5510.59 CustomerID=ERNSH OrderID=10698 total=3436.44 CustomerID=ERNSH OrderID=10764 total=2286.00 CustomerID=ERNSH OrderID=10773 total=2030.40 CustomerID=ERNSH OrderID=10776 total=6635.28 CustomerID=ERNSH OrderID=10795 total=2158.00 CustomerID=ERNSH OrderID=10836 total=4705.50 CustomerID=ERNSH OrderID=10854 total=2966.50 CustomerID=ERNSH OrderID=10895 total=6379.40 CustomerID=ERNSH OrderID=10979 total=4813.50

CustomerID=ERNSH OrderID=10990 total=4288.85 CustomerID=ERNSH OrderID=11008 total=4680.90 CustomerID=ERNSH OrderID=11017 total=6750.00 CustomerID=ERNSH OrderID=11072 total=5218.00 CustomerID=FOLIG OrderID=10634 total=4985.50 CustomerID=FOLIG OrderID=10789 total=3687.00 CustomerID=FOLKO OrderID=10533 total=2222.20 CustomerID=FOLKO OrderID=10561 total=2844.50 CustomerID=FOLKO OrderID=10703 total=2545.00 CustomerID=FOLKO OrderID=10762 total=4337.00 CustomerID=FOLKO OrderID=10977 total=2233.00 CustomerID=FOLKO OrderID=10993 total=4895.44 CustomerID=FOLKO OrderID=11001 total=2769.00 CustomerID=FRANK OrderID=10267 total=3536.60 CustomerID=FRANK OrderID=10337 total=2467.00 CustomerID=FRANK OrderID=10670 total=2301.75 CustomerID=FRANK OrderID=11012 total=2825.30 CustomerID=GODOS OrderID=10629 total=2775.05 CustomerID=GODOS OrderID=10872 total=2058.46 CustomerID=GODOS OrderID=10948 total=2362.25 CustomerID=GOURL OrderID=10709 total=3424.00 CustomerID=GREAL OrderID=10616 total=4807.00 CustomerID=GREAL OrderID=10816 total=8446.45 CustomerID=HANAR OrderID=10886 total=3127.50 CustomerID=HANAR OrderID=10981 total=15810.00 CustomerID=HILAA OrderID=10395 total=2122.92 CustomerID=HILAA OrderID=10490 total=3163.20 CustomerID=HILAA OrderID=10601 total=2285.00 CustomerID=HILAA OrderID=10641 total=2054.00 CustomerID=HILAA OrderID=10796 total=2341.36 CustomerID=HUNGO OrderID=10298 total=2645.00 CustomerID=HUNGO OrderID=10335 total=2036.16 CustomerID=HUNGO OrderID=10503 total=2048.50 CustomerID=HUNGO OrderID=10516 total=2381.05 CustomerID=HUNGO OrderID=10567 total=2519.00 CustomerID=HUNGO OrderID=10687 total=4960.90 CustomerID=HUNGO OrderID=10701 total=2864.50 CustomerID=HUNGO OrderID=10897 total=10835.24 CustomerID=HUNGO OrderID=10912 total=6200.55 CustomerID=HUNGO OrderID=10985 total=2023.38 CustomerID=KOENE OrderID=10718 total=3463.00 CustomerID=KOENE OrderID=10817 total=10952.84 CustomerID=KOENE OrderID=10893 total=5502.11 CustomerID=KOENE OrderID=11028 total=2160.00 CustomerID=LAMAI OrderID=10413 total=2123.20 CustomerID=LAMAI OrderID=10787 total=2622.76 CustomerID=LEHMS OrderID=10522 total=2318.24

CustomerID=LEHMS OrderID=10772 total=3603.22 CustomerID=LILAS OrderID=10823 total=2826.00 CustomerID=LINOD OrderID=10638 total=2720.05 CustomerID=LINOD OrderID=11039 total=3090.00 CustomerID=MAISD OrderID=10760 total=2917.00 CustomerID=MAISD OrderID=10892 total=2090.00 CustomerID=MEREP OrderID=10339 total=3354.00 CustomerID=MEREP OrderID=10424 total=9194.56 CustomerID=MEREP OrderID=10570 total=2465.25 CustomerID=MEREP OrderID=10605 total=4109.70 CustomerID=MEREP OrderID=10618 total=2697.50 CustomerID=MORGK OrderID=10575 total=2147.40 CustomerID=OCEAN OrderID=10986 total=2220.00 CustomerID=OLDWO OrderID=10305 total=3741.30 CustomerID=OLDWO OrderID=10855 total=2227.89 CustomerID=OTTIK OrderID=10766 total=2310.00 CustomerID=PICCO OrderID=10353 total=8593.28 CustomerID=PICCO OrderID=10530 total=4180.00 CustomerID=PICCO OrderID=11053 total=3055.00 CustomerID=PRINI OrderID=11007 total=2633.90 CustomerID=QUEEN OrderID=10372 total=9210.90 CustomerID=QUEEN OrderID=10637 total=2761.94 CustomerID=QUEEN OrderID=11068 total=2027.08 CustomerID=QUICK OrderID=10273 total=2037.28 CustomerID=QUICK OrderID=10286 total=3016.00 CustomerID=QUICK OrderID=10345 total=2924.80 CustomerID=QUICK OrderID=10361 total=2046.24 CustomerID=QUICK OrderID=10451 total=3849.66 CustomerID=QUICK OrderID=10515 total=9921.30 CustomerID=QUICK OrderID=10540 total=10191.70 CustomerID=QUICK OrderID=10549 total=3554.28 CustomerID=QUICK OrderID=10588 total=3120.00 CustomerID=QUICK OrderID=10658 total=4464.60 CustomerID=QUICK OrderID=10691 total=10164.80 CustomerID=QUICK OrderID=10694 total=4825.00 CustomerID=QUICK OrderID=10745 total=4529.80 CustomerID=QUICK OrderID=10845 total=3812.70 CustomerID=QUICK OrderID=10865 total=16387.50 CustomerID=QUICK OrderID=10938 total=2731.88 CustomerID=QUICK OrderID=10962 total=3584.00 CustomerID=QUICK OrderID=10991 total=2296.00 CustomerID=QUICK OrderID=11021 total=6306.24 CustomerID=RATTC OrderID=10314 total=2094.30 CustomerID=RATTC OrderID=10316 total=2835.00 CustomerID=RATTC OrderID=10401 total=3868.60 CustomerID=RATTC OrderID=10479 total=10495.60 CustomerID=RATTC OrderID=10598 total=2388.50

CustomerID=RATTC OrderID=10852 total=2984.00 CustomerID=RATTC OrderID=10889 total=11380.00 CustomerID=RATTC OrderID=10988 total=3574.80 CustomerID=RICAR OrderID=10851 total=2603.00 CustomerID=RICSU OrderID=10255 total=2490.50 CustomerID=RICSU OrderID=10419 total=2097.60 CustomerID=RICSU OrderID=10666 total=4666.94 CustomerID=RICSU OrderID=11033 total=3232.80 CustomerID=SANTG OrderID=10831 total=2684.40 CustomerID=SAVEA OrderID=10324 total=5275.72 CustomerID=SAVEA OrderID=10393 total=2556.95 CustomerID=SAVEA OrderID=10398 total=2505.60 CustomerID=SAVEA OrderID=10440 total=4924.14 CustomerID=SAVEA OrderID=10452 total=2018.50 CustomerID=SAVEA OrderID=10510 total=4707.54 CustomerID=SAVEA OrderID=10555 total=2944.40 CustomerID=SAVEA OrderID=10607 total=6475.40 CustomerID=SAVEA OrderID=10612 total=6375.00 CustomerID=SAVEA OrderID=10657 total=4371.60 CustomerID=SAVEA OrderID=10678 total=5256.50 CustomerID=SAVEA OrderID=10711 total=4451.70 CustomerID=SAVEA OrderID=10713 total=2827.90 CustomerID=SAVEA OrderID=10714 total=2205.75 CustomerID=SAVEA OrderID=10748 total=2196.00 CustomerID=SAVEA OrderID=10757 total=3082.00 CustomerID=SAVEA OrderID=10847 total=4931.92 CustomerID=SAVEA OrderID=10894 total=2753.10 CustomerID=SAVEA OrderID=10941 total=4011.75 CustomerID=SAVEA OrderID=11030 total=12615.05 CustomerID=SAVEA OrderID=11031 total=2393.50 CustomerID=SAVEA OrderID=11064 total=4330.40 CustomerID=SEVES OrderID=10359 total=3471.68 CustomerID=SEVES OrderID=10523 total=2444.31 CustomerID=SEVES OrderID=10804 total=2278.40 CustomerID=SIMOB OrderID=10417 total=11188.40 CustomerID=SIMOB OrderID=10802 total=2942.81 CustomerID=SPECD OrderID=10964 total=2052.50 CustomerID=SPLIR OrderID=10329 total=4578.43 CustomerID=SPLIR OrderID=10369 total=2390.40 CustomerID=SUPRD OrderID=10252 total=3597.90 CustomerID=SUPRD OrderID=10302 total=2708.80 CustomerID=SUPRD OrderID=10458 total=3891.00 CustomerID=SUPRD OrderID=10841 total=4581.00 CustomerID=SUPRD OrderID=10930 total=2255.50 CustomerID=THEBI OrderID=10805 total=2775.00 CustomerID=TORTU OrderID=10518 total=4150.05 CustomerID=VAFFE OrderID=10465 total=2518.00

CustomerID=VAFFE OrderID=10688 total=3160.60 CustomerID=VICTE OrderID=10546 total=2812.00 CustomerID=WARTH OrderID=10455 total=2684.00 CustomerID=WARTH OrderID=10583 total=2237.50 CustomerID=WHITC OrderID=10344 total=2296.00 CustomerID=WHITC OrderID=10693 total=2071.20 CustomerID=WHITC OrderID=10861 total=3523.40 CustomerID=WHITC OrderID=11032 total=8902.50

SelectMany - Multiple from


This sample uses multiple from clauses so that filtering on customers can be done before selecting their orders. This makes the query more efficient by not selecting and then discarding orders for customers outside of Washington. public void Linq18() { List customers = GetCustomerList(); DateTime cutoffDate = new DateTime(1997, 1, 1); var orders = from c in customers where c.Region == "WA" from o in c.Orders where o.OrderDate >= cutoffDate select new {c.CustomerID, o.OrderID}; ObjectDumper.Write(orders); } Result CustomerID=LAZYK OrderID=10482 CustomerID=LAZYK OrderID=10545 CustomerID=TRAIH OrderID=10574 CustomerID=TRAIH OrderID=10577 CustomerID=TRAIH OrderID=10822 CustomerID=WHITC OrderID=10469 CustomerID=WHITC OrderID=10483 CustomerID=WHITC OrderID=10504 CustomerID=WHITC OrderID=10596 CustomerID=WHITC OrderID=10693 CustomerID=WHITC OrderID=10696 CustomerID=WHITC OrderID=10723 CustomerID=WHITC OrderID=10740 CustomerID=WHITC OrderID=10861 CustomerID=WHITC OrderID=10904 CustomerID=WHITC OrderID=11032 CustomerID=WHITC OrderID=11066

SelectMany - Indexed
This sample prints the customer number and orderID for every order in the database. The sample uses an indexed SelectMany clause to select all orders, while referring to customers by the order in which they are returned from the query. public void Linq19() { List customers = GetCustomerList(); var customerOrders = customers.SelectMany( (cust, custIndex) => cust.Orders.Select(o => "Customer #" + (custIndex + 1) + " has an order with OrderID " + o.OrderID) ); ObjectDumper.Write(customerOrders); } Result Customer #1 has an order with OrderID 10643 Customer #1 has an order with OrderID 10692 Customer #1 has an order with OrderID 10702 Customer #1 has an order with OrderID 10835 Customer #1 has an order with OrderID 10952 Customer #1 has an order with OrderID 11011 Customer #2 has an order with OrderID 10308 Customer #2 has an order with OrderID 10625 Customer #2 has an order with OrderID 10759 Customer #2 has an order with OrderID 10926 Customer #3 has an order with OrderID 10365 Customer #3 has an order with OrderID 10507 Customer #3 has an order with OrderID 10535 Customer #3 has an order with OrderID 10573 Customer #3 has an order with OrderID 10677 Customer #3 has an order with OrderID 10682 Customer #3 has an order with OrderID 10856 Customer #4 has an order with OrderID 10355 Customer #4 has an order with OrderID 10383 Customer #4 has an order with OrderID 10453 Customer #4 has an order with OrderID 10558 Customer #4 has an order with OrderID 10707 Customer #4 has an order with OrderID 10741 Customer #4 has an order with OrderID 10743 Customer #4 has an order with OrderID 10768 Customer #4 has an order with OrderID 10793 Customer #4 has an order with OrderID 10864 Customer #4 has an order with OrderID 10920

Customer #4 has an order with OrderID 10953 Customer #4 has an order with OrderID 11016 Customer #5 has an order with OrderID 10278 Customer #5 has an order with OrderID 10280 Customer #5 has an order with OrderID 10384 Customer #5 has an order with OrderID 10444 Customer #5 has an order with OrderID 10445 Customer #5 has an order with OrderID 10524 Customer #5 has an order with OrderID 10572 Customer #5 has an order with OrderID 10626 Customer #5 has an order with OrderID 10654 Customer #5 has an order with OrderID 10672 Customer #5 has an order with OrderID 10689 Customer #5 has an order with OrderID 10733 Customer #5 has an order with OrderID 10778 Customer #5 has an order with OrderID 10837 Customer #5 has an order with OrderID 10857 Customer #5 has an order with OrderID 10866 Customer #5 has an order with OrderID 10875 Customer #5 has an order with OrderID 10924 Customer #6 has an order with OrderID 10501 Customer #6 has an order with OrderID 10509 Customer #6 has an order with OrderID 10582 Customer #6 has an order with OrderID 10614 Customer #6 has an order with OrderID 10853 Customer #6 has an order with OrderID 10956 Customer #6 has an order with OrderID 11058 Customer #7 has an order with OrderID 10265 Customer #7 has an order with OrderID 10297 Customer #7 has an order with OrderID 10360 Customer #7 has an order with OrderID 10436 Customer #7 has an order with OrderID 10449 Customer #7 has an order with OrderID 10559 Customer #7 has an order with OrderID 10566 Customer #7 has an order with OrderID 10584 Customer #7 has an order with OrderID 10628 Customer #7 has an order with OrderID 10679 Customer #7 has an order with OrderID 10826 Customer #8 has an order with OrderID 10326 Customer #8 has an order with OrderID 10801 Customer #8 has an order with OrderID 10970 Customer #9 has an order with OrderID 10331 Customer #9 has an order with OrderID 10340 Customer #9 has an order with OrderID 10362 Customer #9 has an order with OrderID 10470 Customer #9 has an order with OrderID 10511 Customer #9 has an order with OrderID 10525

Customer #9 has an order with OrderID 10663 Customer #9 has an order with OrderID 10715 Customer #9 has an order with OrderID 10730 Customer #9 has an order with OrderID 10732 Customer #9 has an order with OrderID 10755 Customer #9 has an order with OrderID 10827 Customer #9 has an order with OrderID 10871 Customer #9 has an order with OrderID 10876 Customer #9 has an order with OrderID 10932 Customer #9 has an order with OrderID 10940 Customer #9 has an order with OrderID 11076 Customer #10 has an order with OrderID 10389 Customer #10 has an order with OrderID 10410 Customer #10 has an order with OrderID 10411 Customer #10 has an order with OrderID 10431 Customer #10 has an order with OrderID 10492 Customer #10 has an order with OrderID 10742 Customer #10 has an order with OrderID 10918 Customer #10 has an order with OrderID 10944 Customer #10 has an order with OrderID 10949 Customer #10 has an order with OrderID 10975 Customer #10 has an order with OrderID 10982 Customer #10 has an order with OrderID 11027 Customer #10 has an order with OrderID 11045 Customer #10 has an order with OrderID 11048 Customer #11 has an order with OrderID 10289 Customer #11 has an order with OrderID 10471 Customer #11 has an order with OrderID 10484 Customer #11 has an order with OrderID 10538 Customer #11 has an order with OrderID 10539 Customer #11 has an order with OrderID 10578 Customer #11 has an order with OrderID 10599 Customer #11 has an order with OrderID 10943 Customer #11 has an order with OrderID 10947 Customer #11 has an order with OrderID 11023 Customer #12 has an order with OrderID 10521 Customer #12 has an order with OrderID 10782 Customer #12 has an order with OrderID 10819 Customer #12 has an order with OrderID 10881 Customer #12 has an order with OrderID 10937 Customer #12 has an order with OrderID 11054 Customer #13 has an order with OrderID 10259 Customer #14 has an order with OrderID 10254 Customer #14 has an order with OrderID 10370 Customer #14 has an order with OrderID 10519 Customer #14 has an order with OrderID 10731 Customer #14 has an order with OrderID 10746

Customer #14 has an order with OrderID 10966 Customer #14 has an order with OrderID 11029 Customer #14 has an order with OrderID 11041 Customer #15 has an order with OrderID 10290 Customer #15 has an order with OrderID 10466 Customer #15 has an order with OrderID 10494 Customer #15 has an order with OrderID 10969 Customer #15 has an order with OrderID 11042 Customer #16 has an order with OrderID 10435 Customer #16 has an order with OrderID 10462 Customer #16 has an order with OrderID 10848 Customer #17 has an order with OrderID 10363 Customer #17 has an order with OrderID 10391 Customer #17 has an order with OrderID 10797 Customer #17 has an order with OrderID 10825 Customer #17 has an order with OrderID 11036 Customer #17 has an order with OrderID 11067 Customer #18 has an order with OrderID 10311 Customer #18 has an order with OrderID 10609 Customer #18 has an order with OrderID 10683 Customer #18 has an order with OrderID 10890 Customer #19 has an order with OrderID 10364 Customer #19 has an order with OrderID 10400 Customer #19 has an order with OrderID 10532 Customer #19 has an order with OrderID 10726 Customer #19 has an order with OrderID 10987 Customer #19 has an order with OrderID 11024 Customer #19 has an order with OrderID 11047 Customer #19 has an order with OrderID 11056 Customer #20 has an order with OrderID 10258 Customer #20 has an order with OrderID 10263 Customer #20 has an order with OrderID 10351 Customer #20 has an order with OrderID 10368 Customer #20 has an order with OrderID 10382 Customer #20 has an order with OrderID 10390 Customer #20 has an order with OrderID 10402 Customer #20 has an order with OrderID 10403 Customer #20 has an order with OrderID 10430 Customer #20 has an order with OrderID 10442 Customer #20 has an order with OrderID 10514 Customer #20 has an order with OrderID 10571 Customer #20 has an order with OrderID 10595 Customer #20 has an order with OrderID 10633 Customer #20 has an order with OrderID 10667 Customer #20 has an order with OrderID 10698 Customer #20 has an order with OrderID 10764 Customer #20 has an order with OrderID 10771

Customer #20 has an order with OrderID 10773 Customer #20 has an order with OrderID 10776 Customer #20 has an order with OrderID 10795 Customer #20 has an order with OrderID 10836 Customer #20 has an order with OrderID 10854 Customer #20 has an order with OrderID 10895 Customer #20 has an order with OrderID 10968 Customer #20 has an order with OrderID 10979 Customer #20 has an order with OrderID 10990 Customer #20 has an order with OrderID 11008 Customer #20 has an order with OrderID 11017 Customer #20 has an order with OrderID 11072 Customer #21 has an order with OrderID 10347 Customer #21 has an order with OrderID 10386 Customer #21 has an order with OrderID 10414 Customer #21 has an order with OrderID 10512 Customer #21 has an order with OrderID 10581 Customer #21 has an order with OrderID 10650 Customer #21 has an order with OrderID 10725 Customer #23 has an order with OrderID 10408 Customer #23 has an order with OrderID 10480 Customer #23 has an order with OrderID 10634 Customer #23 has an order with OrderID 10763 Customer #23 has an order with OrderID 10789 Customer #24 has an order with OrderID 10264 Customer #24 has an order with OrderID 10327 Customer #24 has an order with OrderID 10378 Customer #24 has an order with OrderID 10434 Customer #24 has an order with OrderID 10460 Customer #24 has an order with OrderID 10533 Customer #24 has an order with OrderID 10561 Customer #24 has an order with OrderID 10703 Customer #24 has an order with OrderID 10762 Customer #24 has an order with OrderID 10774 Customer #24 has an order with OrderID 10824 Customer #24 has an order with OrderID 10880 Customer #24 has an order with OrderID 10902 Customer #24 has an order with OrderID 10955 Customer #24 has an order with OrderID 10977 Customer #24 has an order with OrderID 10980 Customer #24 has an order with OrderID 10993 Customer #24 has an order with OrderID 11001 Customer #24 has an order with OrderID 11050 Customer #25 has an order with OrderID 10267 Customer #25 has an order with OrderID 10337 Customer #25 has an order with OrderID 10342 Customer #25 has an order with OrderID 10396

Customer #25 has an order with OrderID 10488 Customer #25 has an order with OrderID 10560 Customer #25 has an order with OrderID 10623 Customer #25 has an order with OrderID 10653 Customer #25 has an order with OrderID 10670 Customer #25 has an order with OrderID 10675 Customer #25 has an order with OrderID 10717 Customer #25 has an order with OrderID 10791 Customer #25 has an order with OrderID 10859 Customer #25 has an order with OrderID 10929 Customer #25 has an order with OrderID 11012 Customer #26 has an order with OrderID 10671 Customer #26 has an order with OrderID 10860 Customer #26 has an order with OrderID 10971 Customer #27 has an order with OrderID 10422 Customer #27 has an order with OrderID 10710 Customer #27 has an order with OrderID 10753 Customer #27 has an order with OrderID 10807 Customer #27 has an order with OrderID 11026 Customer #27 has an order with OrderID 11060 Customer #28 has an order with OrderID 10328 Customer #28 has an order with OrderID 10352 Customer #28 has an order with OrderID 10464 Customer #28 has an order with OrderID 10491 Customer #28 has an order with OrderID 10551 Customer #28 has an order with OrderID 10604 Customer #28 has an order with OrderID 10664 Customer #28 has an order with OrderID 10963 Customer #29 has an order with OrderID 10366 Customer #29 has an order with OrderID 10426 Customer #29 has an order with OrderID 10568 Customer #29 has an order with OrderID 10887 Customer #29 has an order with OrderID 10928 Customer #30 has an order with OrderID 10303 Customer #30 has an order with OrderID 10550 Customer #30 has an order with OrderID 10629 Customer #30 has an order with OrderID 10872 Customer #30 has an order with OrderID 10874 Customer #30 has an order with OrderID 10888 Customer #30 has an order with OrderID 10911 Customer #30 has an order with OrderID 10948 Customer #30 has an order with OrderID 11009 Customer #30 has an order with OrderID 11037 Customer #31 has an order with OrderID 10423 Customer #31 has an order with OrderID 10652 Customer #31 has an order with OrderID 10685 Customer #31 has an order with OrderID 10709

Customer #31 has an order with OrderID 10734 Customer #31 has an order with OrderID 10777 Customer #31 has an order with OrderID 10790 Customer #31 has an order with OrderID 10959 Customer #31 has an order with OrderID 11049 Customer #32 has an order with OrderID 10528 Customer #32 has an order with OrderID 10589 Customer #32 has an order with OrderID 10616 Customer #32 has an order with OrderID 10617 Customer #32 has an order with OrderID 10656 Customer #32 has an order with OrderID 10681 Customer #32 has an order with OrderID 10816 Customer #32 has an order with OrderID 10936 Customer #32 has an order with OrderID 11006 Customer #32 has an order with OrderID 11040 Customer #32 has an order with OrderID 11061 Customer #33 has an order with OrderID 10268 Customer #33 has an order with OrderID 10785 Customer #34 has an order with OrderID 10250 Customer #34 has an order with OrderID 10253 Customer #34 has an order with OrderID 10541 Customer #34 has an order with OrderID 10645 Customer #34 has an order with OrderID 10690 Customer #34 has an order with OrderID 10770 Customer #34 has an order with OrderID 10783 Customer #34 has an order with OrderID 10886 Customer #34 has an order with OrderID 10903 Customer #34 has an order with OrderID 10922 Customer #34 has an order with OrderID 10925 Customer #34 has an order with OrderID 10981 Customer #34 has an order with OrderID 11022 Customer #34 has an order with OrderID 11052 Customer #35 has an order with OrderID 10257 Customer #35 has an order with OrderID 10395 Customer #35 has an order with OrderID 10476 Customer #35 has an order with OrderID 10486 Customer #35 has an order with OrderID 10490 Customer #35 has an order with OrderID 10498 Customer #35 has an order with OrderID 10552 Customer #35 has an order with OrderID 10601 Customer #35 has an order with OrderID 10613 Customer #35 has an order with OrderID 10641 Customer #35 has an order with OrderID 10705 Customer #35 has an order with OrderID 10796 Customer #35 has an order with OrderID 10863 Customer #35 has an order with OrderID 10901 Customer #35 has an order with OrderID 10957

Customer #35 has an order with OrderID 10960 Customer #35 has an order with OrderID 10976 Customer #35 has an order with OrderID 11055 Customer #36 has an order with OrderID 10375 Customer #36 has an order with OrderID 10394 Customer #36 has an order with OrderID 10415 Customer #36 has an order with OrderID 10600 Customer #36 has an order with OrderID 10660 Customer #37 has an order with OrderID 10298 Customer #37 has an order with OrderID 10309 Customer #37 has an order with OrderID 10335 Customer #37 has an order with OrderID 10373 Customer #37 has an order with OrderID 10380 Customer #37 has an order with OrderID 10429 Customer #37 has an order with OrderID 10503 Customer #37 has an order with OrderID 10516 Customer #37 has an order with OrderID 10567 Customer #37 has an order with OrderID 10646 Customer #37 has an order with OrderID 10661 Customer #37 has an order with OrderID 10687 Customer #37 has an order with OrderID 10701 Customer #37 has an order with OrderID 10712 Customer #37 has an order with OrderID 10736 Customer #37 has an order with OrderID 10897 Customer #37 has an order with OrderID 10912 Customer #37 has an order with OrderID 10985 Customer #37 has an order with OrderID 11063 Customer #38 has an order with OrderID 10315 Customer #38 has an order with OrderID 10318 Customer #38 has an order with OrderID 10321 Customer #38 has an order with OrderID 10473 Customer #38 has an order with OrderID 10621 Customer #38 has an order with OrderID 10674 Customer #38 has an order with OrderID 10749 Customer #38 has an order with OrderID 10798 Customer #38 has an order with OrderID 10829 Customer #38 has an order with OrderID 10933 Customer #39 has an order with OrderID 10323 Customer #39 has an order with OrderID 10325 Customer #39 has an order with OrderID 10456 Customer #39 has an order with OrderID 10457 Customer #39 has an order with OrderID 10468 Customer #39 has an order with OrderID 10506 Customer #39 has an order with OrderID 10542 Customer #39 has an order with OrderID 10630 Customer #39 has an order with OrderID 10718 Customer #39 has an order with OrderID 10799

Customer #39 has an order with OrderID 10817 Customer #39 has an order with OrderID 10849 Customer #39 has an order with OrderID 10893 Customer #39 has an order with OrderID 11028 Customer #40 has an order with OrderID 10858 Customer #40 has an order with OrderID 10927 Customer #40 has an order with OrderID 10972 Customer #40 has an order with OrderID 10973 Customer #41 has an order with OrderID 10350 Customer #41 has an order with OrderID 10358 Customer #41 has an order with OrderID 10371 Customer #41 has an order with OrderID 10413 Customer #41 has an order with OrderID 10425 Customer #41 has an order with OrderID 10454 Customer #41 has an order with OrderID 10493 Customer #41 has an order with OrderID 10500 Customer #41 has an order with OrderID 10610 Customer #41 has an order with OrderID 10631 Customer #41 has an order with OrderID 10787 Customer #41 has an order with OrderID 10832 Customer #41 has an order with OrderID 10923 Customer #41 has an order with OrderID 11051 Customer #42 has an order with OrderID 10495 Customer #42 has an order with OrderID 10620 Customer #42 has an order with OrderID 10810 Customer #43 has an order with OrderID 10482 Customer #43 has an order with OrderID 10545 Customer #44 has an order with OrderID 10279 Customer #44 has an order with OrderID 10284 Customer #44 has an order with OrderID 10343 Customer #44 has an order with OrderID 10497 Customer #44 has an order with OrderID 10522 Customer #44 has an order with OrderID 10534 Customer #44 has an order with OrderID 10536 Customer #44 has an order with OrderID 10557 Customer #44 has an order with OrderID 10592 Customer #44 has an order with OrderID 10593 Customer #44 has an order with OrderID 10772 Customer #44 has an order with OrderID 10862 Customer #44 has an order with OrderID 10891 Customer #44 has an order with OrderID 10934 Customer #44 has an order with OrderID 11070 Customer #45 has an order with OrderID 10579 Customer #45 has an order with OrderID 10719 Customer #45 has an order with OrderID 10735 Customer #45 has an order with OrderID 10884 Customer #46 has an order with OrderID 10283

Customer #46 has an order with OrderID 10296 Customer #46 has an order with OrderID 10330 Customer #46 has an order with OrderID 10357 Customer #46 has an order with OrderID 10381 Customer #46 has an order with OrderID 10461 Customer #46 has an order with OrderID 10499 Customer #46 has an order with OrderID 10543 Customer #46 has an order with OrderID 10780 Customer #46 has an order with OrderID 10823 Customer #46 has an order with OrderID 10899 Customer #46 has an order with OrderID 10997 Customer #46 has an order with OrderID 11065 Customer #46 has an order with OrderID 11071 Customer #47 has an order with OrderID 10405 Customer #47 has an order with OrderID 10485 Customer #47 has an order with OrderID 10638 Customer #47 has an order with OrderID 10697 Customer #47 has an order with OrderID 10729 Customer #47 has an order with OrderID 10811 Customer #47 has an order with OrderID 10838 Customer #47 has an order with OrderID 10840 Customer #47 has an order with OrderID 10919 Customer #47 has an order with OrderID 10954 Customer #47 has an order with OrderID 11014 Customer #47 has an order with OrderID 11039 Customer #48 has an order with OrderID 10307 Customer #48 has an order with OrderID 10317 Customer #48 has an order with OrderID 10544 Customer #48 has an order with OrderID 10662 Customer #48 has an order with OrderID 10665 Customer #48 has an order with OrderID 10867 Customer #48 has an order with OrderID 10883 Customer #48 has an order with OrderID 11018 Customer #49 has an order with OrderID 10275 Customer #49 has an order with OrderID 10300 Customer #49 has an order with OrderID 10404 Customer #49 has an order with OrderID 10467 Customer #49 has an order with OrderID 10635 Customer #49 has an order with OrderID 10754 Customer #49 has an order with OrderID 10784 Customer #49 has an order with OrderID 10818 Customer #49 has an order with OrderID 10939 Customer #49 has an order with OrderID 10950 Customer #50 has an order with OrderID 10529 Customer #50 has an order with OrderID 10649 Customer #50 has an order with OrderID 10760 Customer #50 has an order with OrderID 10892

Customer #50 has an order with OrderID 10896 Customer #50 has an order with OrderID 10978 Customer #50 has an order with OrderID 11004 Customer #51 has an order with OrderID 10332 Customer #51 has an order with OrderID 10339 Customer #51 has an order with OrderID 10376 Customer #51 has an order with OrderID 10424 Customer #51 has an order with OrderID 10439 Customer #51 has an order with OrderID 10505 Customer #51 has an order with OrderID 10565 Customer #51 has an order with OrderID 10570 Customer #51 has an order with OrderID 10590 Customer #51 has an order with OrderID 10605 Customer #51 has an order with OrderID 10618 Customer #51 has an order with OrderID 10619 Customer #51 has an order with OrderID 10724 Customer #52 has an order with OrderID 10277 Customer #52 has an order with OrderID 10575 Customer #52 has an order with OrderID 10699 Customer #52 has an order with OrderID 10779 Customer #52 has an order with OrderID 10945 Customer #53 has an order with OrderID 10517 Customer #53 has an order with OrderID 10752 Customer #53 has an order with OrderID 11057 Customer #54 has an order with OrderID 10409 Customer #54 has an order with OrderID 10531 Customer #54 has an order with OrderID 10898 Customer #54 has an order with OrderID 10958 Customer #54 has an order with OrderID 10986 Customer #55 has an order with OrderID 10260 Customer #55 has an order with OrderID 10305 Customer #55 has an order with OrderID 10338 Customer #55 has an order with OrderID 10441 Customer #55 has an order with OrderID 10594 Customer #55 has an order with OrderID 10680 Customer #55 has an order with OrderID 10706 Customer #55 has an order with OrderID 10855 Customer #55 has an order with OrderID 10965 Customer #55 has an order with OrderID 11034 Customer #56 has an order with OrderID 10407 Customer #56 has an order with OrderID 10508 Customer #56 has an order with OrderID 10554 Customer #56 has an order with OrderID 10580 Customer #56 has an order with OrderID 10684 Customer #56 has an order with OrderID 10766 Customer #56 has an order with OrderID 10833 Customer #56 has an order with OrderID 10999

Customer #56 has an order with OrderID 11020 Customer #58 has an order with OrderID 10322 Customer #58 has an order with OrderID 10354 Customer #58 has an order with OrderID 10474 Customer #58 has an order with OrderID 10502 Customer #58 has an order with OrderID 10995 Customer #58 has an order with OrderID 11073 Customer #59 has an order with OrderID 10353 Customer #59 has an order with OrderID 10392 Customer #59 has an order with OrderID 10427 Customer #59 has an order with OrderID 10489 Customer #59 has an order with OrderID 10530 Customer #59 has an order with OrderID 10597 Customer #59 has an order with OrderID 10686 Customer #59 has an order with OrderID 10747 Customer #59 has an order with OrderID 10844 Customer #59 has an order with OrderID 11053 Customer #60 has an order with OrderID 10336 Customer #60 has an order with OrderID 10397 Customer #60 has an order with OrderID 10433 Customer #60 has an order with OrderID 10477 Customer #60 has an order with OrderID 10808 Customer #60 has an order with OrderID 11007 Customer #61 has an order with OrderID 10261 Customer #61 has an order with OrderID 10291 Customer #61 has an order with OrderID 10379 Customer #61 has an order with OrderID 10421 Customer #61 has an order with OrderID 10587 Customer #61 has an order with OrderID 10647 Customer #61 has an order with OrderID 10720 Customer #61 has an order with OrderID 10794 Customer #61 has an order with OrderID 10989 Customer #62 has an order with OrderID 10372 Customer #62 has an order with OrderID 10406 Customer #62 has an order with OrderID 10487 Customer #62 has an order with OrderID 10637 Customer #62 has an order with OrderID 10659 Customer #62 has an order with OrderID 10704 Customer #62 has an order with OrderID 10728 Customer #62 has an order with OrderID 10786 Customer #62 has an order with OrderID 10868 Customer #62 has an order with OrderID 10913 Customer #62 has an order with OrderID 10914 Customer #62 has an order with OrderID 10961 Customer #62 has an order with OrderID 11068 Customer #63 has an order with OrderID 10273 Customer #63 has an order with OrderID 10285

Customer #63 has an order with OrderID 10286 Customer #63 has an order with OrderID 10313 Customer #63 has an order with OrderID 10345 Customer #63 has an order with OrderID 10361 Customer #63 has an order with OrderID 10418 Customer #63 has an order with OrderID 10451 Customer #63 has an order with OrderID 10515 Customer #63 has an order with OrderID 10527 Customer #63 has an order with OrderID 10540 Customer #63 has an order with OrderID 10549 Customer #63 has an order with OrderID 10588 Customer #63 has an order with OrderID 10658 Customer #63 has an order with OrderID 10691 Customer #63 has an order with OrderID 10694 Customer #63 has an order with OrderID 10721 Customer #63 has an order with OrderID 10745 Customer #63 has an order with OrderID 10765 Customer #63 has an order with OrderID 10788 Customer #63 has an order with OrderID 10845 Customer #63 has an order with OrderID 10865 Customer #63 has an order with OrderID 10878 Customer #63 has an order with OrderID 10938 Customer #63 has an order with OrderID 10962 Customer #63 has an order with OrderID 10991 Customer #63 has an order with OrderID 10996 Customer #63 has an order with OrderID 11021 Customer #64 has an order with OrderID 10448 Customer #64 has an order with OrderID 10716 Customer #64 has an order with OrderID 10828 Customer #64 has an order with OrderID 10916 Customer #64 has an order with OrderID 11019 Customer #65 has an order with OrderID 10262 Customer #65 has an order with OrderID 10272 Customer #65 has an order with OrderID 10294 Customer #65 has an order with OrderID 10314 Customer #65 has an order with OrderID 10316 Customer #65 has an order with OrderID 10346 Customer #65 has an order with OrderID 10401 Customer #65 has an order with OrderID 10479 Customer #65 has an order with OrderID 10564 Customer #65 has an order with OrderID 10569 Customer #65 has an order with OrderID 10598 Customer #65 has an order with OrderID 10761 Customer #65 has an order with OrderID 10820 Customer #65 has an order with OrderID 10852 Customer #65 has an order with OrderID 10889 Customer #65 has an order with OrderID 10988

Customer #65 has an order with OrderID 11000 Customer #65 has an order with OrderID 11077 Customer #66 has an order with OrderID 10288 Customer #66 has an order with OrderID 10428 Customer #66 has an order with OrderID 10443 Customer #66 has an order with OrderID 10562 Customer #66 has an order with OrderID 10586 Customer #66 has an order with OrderID 10655 Customer #66 has an order with OrderID 10727 Customer #66 has an order with OrderID 10812 Customer #66 has an order with OrderID 10908 Customer #66 has an order with OrderID 10942 Customer #66 has an order with OrderID 11010 Customer #66 has an order with OrderID 11062 Customer #67 has an order with OrderID 10287 Customer #67 has an order with OrderID 10299 Customer #67 has an order with OrderID 10447 Customer #67 has an order with OrderID 10481 Customer #67 has an order with OrderID 10563 Customer #67 has an order with OrderID 10622 Customer #67 has an order with OrderID 10648 Customer #67 has an order with OrderID 10813 Customer #67 has an order with OrderID 10851 Customer #67 has an order with OrderID 10877 Customer #67 has an order with OrderID 11059 Customer #68 has an order with OrderID 10255 Customer #68 has an order with OrderID 10419 Customer #68 has an order with OrderID 10537 Customer #68 has an order with OrderID 10666 Customer #68 has an order with OrderID 10751 Customer #68 has an order with OrderID 10758 Customer #68 has an order with OrderID 10931 Customer #68 has an order with OrderID 10951 Customer #68 has an order with OrderID 11033 Customer #68 has an order with OrderID 11075 Customer #69 has an order with OrderID 10281 Customer #69 has an order with OrderID 10282 Customer #69 has an order with OrderID 10306 Customer #69 has an order with OrderID 10917 Customer #69 has an order with OrderID 11013 Customer #70 has an order with OrderID 10387 Customer #70 has an order with OrderID 10520 Customer #70 has an order with OrderID 10639 Customer #70 has an order with OrderID 10831 Customer #70 has an order with OrderID 10909 Customer #70 has an order with OrderID 11015 Customer #71 has an order with OrderID 10324

Customer #71 has an order with OrderID 10393 Customer #71 has an order with OrderID 10398 Customer #71 has an order with OrderID 10440 Customer #71 has an order with OrderID 10452 Customer #71 has an order with OrderID 10510 Customer #71 has an order with OrderID 10555 Customer #71 has an order with OrderID 10603 Customer #71 has an order with OrderID 10607 Customer #71 has an order with OrderID 10612 Customer #71 has an order with OrderID 10627 Customer #71 has an order with OrderID 10657 Customer #71 has an order with OrderID 10678 Customer #71 has an order with OrderID 10700 Customer #71 has an order with OrderID 10711 Customer #71 has an order with OrderID 10713 Customer #71 has an order with OrderID 10714 Customer #71 has an order with OrderID 10722 Customer #71 has an order with OrderID 10748 Customer #71 has an order with OrderID 10757 Customer #71 has an order with OrderID 10815 Customer #71 has an order with OrderID 10847 Customer #71 has an order with OrderID 10882 Customer #71 has an order with OrderID 10894 Customer #71 has an order with OrderID 10941 Customer #71 has an order with OrderID 10983 Customer #71 has an order with OrderID 10984 Customer #71 has an order with OrderID 11002 Customer #71 has an order with OrderID 11030 Customer #71 has an order with OrderID 11031 Customer #71 has an order with OrderID 11064 Customer #72 has an order with OrderID 10359 Customer #72 has an order with OrderID 10377 Customer #72 has an order with OrderID 10388 Customer #72 has an order with OrderID 10472 Customer #72 has an order with OrderID 10523 Customer #72 has an order with OrderID 10547 Customer #72 has an order with OrderID 10800 Customer #72 has an order with OrderID 10804 Customer #72 has an order with OrderID 10869 Customer #73 has an order with OrderID 10341 Customer #73 has an order with OrderID 10417 Customer #73 has an order with OrderID 10556 Customer #73 has an order with OrderID 10642 Customer #73 has an order with OrderID 10669 Customer #73 has an order with OrderID 10802 Customer #73 has an order with OrderID 11074 Customer #74 has an order with OrderID 10738

Customer #74 has an order with OrderID 10907 Customer #74 has an order with OrderID 10964 Customer #74 has an order with OrderID 11043 Customer #75 has an order with OrderID 10271 Customer #75 has an order with OrderID 10329 Customer #75 has an order with OrderID 10349 Customer #75 has an order with OrderID 10369 Customer #75 has an order with OrderID 10385 Customer #75 has an order with OrderID 10432 Customer #75 has an order with OrderID 10756 Customer #75 has an order with OrderID 10821 Customer #75 has an order with OrderID 10974 Customer #76 has an order with OrderID 10252 Customer #76 has an order with OrderID 10302 Customer #76 has an order with OrderID 10458 Customer #76 has an order with OrderID 10463 Customer #76 has an order with OrderID 10475 Customer #76 has an order with OrderID 10767 Customer #76 has an order with OrderID 10841 Customer #76 has an order with OrderID 10846 Customer #76 has an order with OrderID 10885 Customer #76 has an order with OrderID 10930 Customer #76 has an order with OrderID 11035 Customer #76 has an order with OrderID 11038 Customer #77 has an order with OrderID 10310 Customer #77 has an order with OrderID 10708 Customer #77 has an order with OrderID 10805 Customer #77 has an order with OrderID 10992 Customer #78 has an order with OrderID 10624 Customer #78 has an order with OrderID 10775 Customer #78 has an order with OrderID 11003 Customer #79 has an order with OrderID 10438 Customer #79 has an order with OrderID 10446 Customer #79 has an order with OrderID 10548 Customer #79 has an order with OrderID 10608 Customer #79 has an order with OrderID 10967 Customer #80 has an order with OrderID 10276 Customer #80 has an order with OrderID 10293 Customer #80 has an order with OrderID 10304 Customer #80 has an order with OrderID 10319 Customer #80 has an order with OrderID 10518 Customer #80 has an order with OrderID 10576 Customer #80 has an order with OrderID 10676 Customer #80 has an order with OrderID 10842 Customer #80 has an order with OrderID 10915 Customer #80 has an order with OrderID 11069 Customer #81 has an order with OrderID 10249

Customer #81 has an order with OrderID 10292 Customer #81 has an order with OrderID 10496 Customer #81 has an order with OrderID 10606 Customer #81 has an order with OrderID 10830 Customer #81 has an order with OrderID 10834 Customer #81 has an order with OrderID 10839 Customer #82 has an order with OrderID 10574 Customer #82 has an order with OrderID 10577 Customer #82 has an order with OrderID 10822 Customer #83 has an order with OrderID 10367 Customer #83 has an order with OrderID 10399 Customer #83 has an order with OrderID 10465 Customer #83 has an order with OrderID 10591 Customer #83 has an order with OrderID 10602 Customer #83 has an order with OrderID 10688 Customer #83 has an order with OrderID 10744 Customer #83 has an order with OrderID 10769 Customer #83 has an order with OrderID 10921 Customer #83 has an order with OrderID 10946 Customer #83 has an order with OrderID 10994 Customer #84 has an order with OrderID 10251 Customer #84 has an order with OrderID 10334 Customer #84 has an order with OrderID 10450 Customer #84 has an order with OrderID 10459 Customer #84 has an order with OrderID 10478 Customer #84 has an order with OrderID 10546 Customer #84 has an order with OrderID 10806 Customer #84 has an order with OrderID 10814 Customer #84 has an order with OrderID 10843 Customer #84 has an order with OrderID 10850 Customer #85 has an order with OrderID 10274 Customer #85 has an order with OrderID 10295 Customer #85 has an order with OrderID 10737 Customer #85 has an order with OrderID 10739 Customer #86 has an order with OrderID 10301 Customer #86 has an order with OrderID 10312 Customer #86 has an order with OrderID 10348 Customer #86 has an order with OrderID 10356 Customer #86 has an order with OrderID 10513 Customer #86 has an order with OrderID 10632 Customer #86 has an order with OrderID 10640 Customer #86 has an order with OrderID 10651 Customer #86 has an order with OrderID 10668 Customer #86 has an order with OrderID 11046 Customer #87 has an order with OrderID 10266 Customer #87 has an order with OrderID 10270 Customer #87 has an order with OrderID 10320

Customer #87 has an order with OrderID 10333 Customer #87 has an order with OrderID 10412 Customer #87 has an order with OrderID 10416 Customer #87 has an order with OrderID 10437 Customer #87 has an order with OrderID 10455 Customer #87 has an order with OrderID 10526 Customer #87 has an order with OrderID 10553 Customer #87 has an order with OrderID 10583 Customer #87 has an order with OrderID 10636 Customer #87 has an order with OrderID 10750 Customer #87 has an order with OrderID 10781 Customer #87 has an order with OrderID 11025 Customer #88 has an order with OrderID 10256 Customer #88 has an order with OrderID 10420 Customer #88 has an order with OrderID 10585 Customer #88 has an order with OrderID 10644 Customer #88 has an order with OrderID 10803 Customer #88 has an order with OrderID 10809 Customer #88 has an order with OrderID 10900 Customer #88 has an order with OrderID 10905 Customer #88 has an order with OrderID 10935 Customer #89 has an order with OrderID 10269 Customer #89 has an order with OrderID 10344 Customer #89 has an order with OrderID 10469 Customer #89 has an order with OrderID 10483 Customer #89 has an order with OrderID 10504 Customer #89 has an order with OrderID 10596 Customer #89 has an order with OrderID 10693 Customer #89 has an order with OrderID 10696 Customer #89 has an order with OrderID 10723 Customer #89 has an order with OrderID 10740 Customer #89 has an order with OrderID 10861 Customer #89 has an order with OrderID 10904 Customer #89 has an order with OrderID 11032 Customer #89 has an order with OrderID 11066 Customer #90 has an order with OrderID 10248 Customer #90 has an order with OrderID 10615 Customer #90 has an order with OrderID 10673 Customer #90 has an order with OrderID 10695 Customer #90 has an order with OrderID 10873 Customer #90 has an order with OrderID 10879 Customer #90 has an order with OrderID 10910 Customer #90 has an order with OrderID 11005 Customer #91 has an order with OrderID 10374 Customer #91 has an order with OrderID 10611 Customer #91 has an order with OrderID 10792 Customer #91 has an order with OrderID 10870

Customer #91 has an order with OrderID 10906 Customer #91 has an order with OrderID 10998 Customer #91 has an order with OrderID 11044

========================================================== ===========================Take - Simple


This sample uses Take to generate a sequence of the first three elements of an integer array. It then iterates through the sequence to print the results. public void Linq20() { int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; var first3Numbers = numbers.Take(3); Console.WriteLine("First 3 numbers:"); foreach (var n in first3Numbers) { Console.WriteLine(n); } } Result First 3 numbers: 5 4 1

Take - Nested
This sample prints the customer ID, order ID, and order date for the first three orders from customers in Washington. The sample uses Take to limit the sequence generated by the query expression to the first three of the orders. public void Linq21() { List<Customer> customers = GetCustomerList(); var first3WAOrders = ( from c in customers from o in c.Orders where c.Region == "WA" select new {c.CustomerID, o.OrderID, o.OrderDate} ) .Take(3); Console.WriteLine("First 3 orders in WA:"); foreach (var order in first3WAOrders) { ObjectDumper.Write(order); } } Result First 3 orders in WA: CustomerID=LAZYK OrderID=10482 OrderDate=3/21/1997

CustomerID=LAZYK OrderID=10545 OrderDate=5/22/1997 CustomerID=TRAIH OrderID=10574 OrderDate=6/19/1997

Skip - Simple
This sample uses Skip to get all but the first 4 elements of the array. public void Linq22() { int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; var allButFirst4Numbers = numbers.Skip(4); Console.WriteLine("All but first 4 numbers:"); foreach (var n in allButFirst4Numbers) { Console.WriteLine(n); } } Result All but first 4 numbers: 9 8 6 7 2 0

Skip - Nested
This sample displays orders from all but the first two customers in Washington. It uses a query expression to create a sequence of elements that have the customer ID, order ID, and order date of orders from customers from Washington, then uses Skip to create a new sequence without the first two elements. public void Linq23() { List<Customer> customers = GetCustomerList(); var waOrders = from c in customers from o in c.Orders where c.Region == "WA" select new {c.CustomerID, o.OrderID, o.OrderDate}; var allButFirst2Orders = waOrders.Skip(2); Console.WriteLine("All but first 2 orders in WA:"); foreach (var order in allButFirst2Orders) { ObjectDumper.Write(order); } } Result All but first 2 orders in WA: CustomerID=TRAIH OrderID=10574 OrderDate=6/19/1997

CustomerID=TRAIH OrderID=10577 OrderDate=6/23/1997 CustomerID=TRAIH OrderID=10822 OrderDate=1/8/1998 CustomerID=WHITC OrderID=10269 OrderDate=7/31/1996 CustomerID=WHITC OrderID=10344 OrderDate=11/1/1996 CustomerID=WHITC OrderID=10469 OrderDate=3/10/1997 CustomerID=WHITC OrderID=10483 OrderDate=3/24/1997 CustomerID=WHITC OrderID=10504 OrderDate=4/11/1997 CustomerID=WHITC OrderID=10596 OrderDate=7/11/1997 CustomerID=WHITC OrderID=10693 OrderDate=10/6/1997 CustomerID=WHITC OrderID=10696 OrderDate=10/8/1997 CustomerID=WHITC OrderID=10723 OrderDate=10/30/1997 CustomerID=WHITC OrderID=10740 OrderDate=11/13/1997 CustomerID=WHITC OrderID=10861 OrderDate=1/30/1998 CustomerID=WHITC OrderID=10904 OrderDate=2/24/1998 CustomerID=WHITC OrderID=11032 OrderDate=4/17/1998 CustomerID=WHITC OrderID=11066 OrderDate=5/1/1998

TakeWhile - Simple
This sample steps through an integer array printing values until a number is reached that is not less than six. The sample uses TakeWhile to generate the sequence, then iterates over the sequence to print the values. public void Linq24() { int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; var firstNumbersLessThan6 = numbers.TakeWhile(n => n < 6); Console.WriteLine("First numbers less than 6:"); foreach (var n in firstNumbersLessThan6) { Console.WriteLine(n); } } Result First numbers less than 6: 5 4 1 3

SkipWhile - Simple
This sample prints all of the elements of an integer array, skipping elements until one of them is divisible by three. The sample uses SkipWhile to create the sequence from the array. The boolean expression in the SkipWhile performs the test using the modulus operator. public void Linq26() { int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; var allButFirst3Numbers = numbers.SkipWhile(n => n % 3 != 0);

Console.WriteLine("All elements starting from first element divisible by 3:"); foreach (var n in allButFirst3Numbers) { Console.WriteLine(n); } } Result All elements starting from first element divisible by 3: 3 9 8 6 7 2 0

SkipWhile - Indexed
This sample prints all of the elements of an integer array, skipping elements until the element's value is less that its position in the array. The sample uses SkipWhile to get the array elements. public void Linq27() { int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; var laterNumbers = numbers.SkipWhile((n, index) => n >= index); Console.WriteLine("All elements starting from first element less than its position:"); foreach (var n in laterNumbers) { Console.WriteLine(n); } } Result All elements starting from first element less than its position: 1 3 9 8 6 7 2 0

OrderBy - Simple 1

This sample prints an alphabetically sorted version of an input string array. The sample uses orderby to perform the sort.

ueberry" };

ds:");

Result The sorted list of words: apple blueberry cherry

OrderBy - Simple 2
This sample prints a version of an input string array sorted by the length each element. The sample uses orderby to sort the words. public void Linq29() { string[] words = { "cherry", "apple", "blueberry" }; var sortedWords = from w in words orderby w.Length select w; Console.WriteLine("The sorted list of words (by length):"); foreach (var w in sortedWords) { Console.WriteLine(w); } } Result The sorted list of words (by length): apple cherry blueberry

OrderBy - Simple 3
This sample prints all of the products sorted alphabetically by the product name. The sample uses orderby to perform the sort. public void Linq30() { List products = GetProductList(); var sortedProducts = from p in products orderby p.ProductName select p; ObjectDumper.Write(sortedProducts); } Result ProductID=17 ProductName=Alice Mutton Category=Meat/Poultry UnitPrice=39.0000 UnitsInStock=0 ProductID=3 ProductName=Aniseed Syrup Category=Condiments UnitPrice=10.0000 UnitsInStock=13 ProductID=40 ProductName=Boston Crab Meat Category=Seafood UnitPrice=18.4000 UnitsInStock=123 ProductID=60 ProductName=Camembert Pierrot Category=Dairy Products UnitPrice=34.0000 UnitsInStock=19 ProductID=18 ProductName=Carnarvon Tigers Category=Seafood UnitPrice=62.5000 UnitsInStock=42 ProductID=1 ProductName=Chai Category=Beverages UnitPrice=18.0000 UnitsInStock=39 ProductID=2 ProductName=Chang Category=Beverages UnitPrice=19.0000 UnitsInStock=17 ProductID=39 ProductName=Chartreuse verte Category=Beverages UnitPrice=18.0000 UnitsInStock=69 ProductID=4 ProductName=Chef Anton's Cajun Seasoning Category=Condiments UnitPrice=22.0000 UnitsInStock=53 ProductID=5 ProductName=Chef Anton's Gumbo Mix Category=Condiments UnitPrice=21.3500 UnitsInStock=0 ProductID=48 ProductName=Chocolade Category=Confections UnitPrice=12.7500 UnitsInStock=15 ProductID=38 ProductName=Cte de Blaye Category=Beverages UnitPrice=263.5000 UnitsInStock=17 ProductID=58 ProductName=Escargots de Bourgogne Category=Seafood UnitPrice=13.2500 UnitsInStock=62 ProductID=52 ProductName=Filo Mix Category=Grains/Cereals UnitPrice=7.0000 UnitsInStock=38 ProductID=71 ProductName=Flotemysost Category=Dairy Products UnitPrice=21.5000 UnitsInStock=26 ProductID=33 ProductName=Geitost Category=Dairy Products UnitPrice=2.5000 UnitsInStock=112 ProductID=15 ProductName=Genen Shouyu Category=Condiments UnitPrice=15.5000 UnitsInStock=39 ProductID=56 ProductName=Gnocchi di nonna Alice Category=Grains/Cereals UnitPrice=38.0000 UnitsInStock=21 ProductID=31 ProductName=Gorgonzola Telino Category=Dairy Products UnitPrice=12.5000 UnitsInStock=0 ProductID=6 ProductName=Grandma's Boysenberry Spread Category=Condiments UnitPrice=25.0000 UnitsInStock=120 ProductID=37 ProductName=Gravad lax Category=Seafood UnitPrice=26.0000 UnitsInStock=11 ProductID=24 ProductName=Guaran Fantstica Category=Beverages UnitPrice=4.5000 UnitsInStock=20 ProductID=69 ProductName=Gudbrandsdalsost Category=Dairy Products UnitPrice=36.0000 UnitsInStock=26 ProductID=44 ProductName=Gula Malacca Category=Condiments UnitPrice=19.4500 UnitsInStock=27 ProductID=26 ProductName=Gumbr Gummibrchen Category=Confections UnitPrice=31.2300 UnitsInStock=15 ProductID=22 ProductName=Gustaf's Knckebrd Category=Grains/Cereals UnitPrice=21.0000 UnitsInStock=104 ProductID=10 ProductName=Ikura Category=Seafood UnitPrice=31.0000 UnitsInStock=31 ProductID=36 ProductName=Inlagd Sill Category=Seafood UnitPrice=19.0000 UnitsInStock=112 ProductID=43 ProductName=Ipoh Coffee Category=Beverages UnitPrice=46.0000 UnitsInStock=17

ProductID=41 ProductName=Jack's New England Clam Chowder Category=Seafood UnitPrice=9.6500 UnitsInStock=85 ProductID=13 ProductName=Konbu Category=Seafood UnitPrice=6.0000 UnitsInStock=24 ProductID=76 ProductName=Lakkalikri Category=Beverages UnitPrice=18.0000 UnitsInStock=57 ProductID=67 ProductName=Laughing Lumberjack Lager Category=Beverages UnitPrice=14.0000 UnitsInStock=52 ProductID=74 ProductName=Longlife Tofu Category=Produce UnitPrice=10.0000 UnitsInStock=4 ProductID=65 ProductName=Louisiana Fiery Hot Pepper Sauce Category=Condiments UnitPrice=21.0500 UnitsInStock=76 ProductID=66 ProductName=Louisiana Hot Spiced Okra Category=Condiments UnitPrice=17.0000 UnitsInStock=4 ProductID=51 ProductName=Manjimup Dried Apples Category=Produce UnitPrice=53.0000 UnitsInStock=20 ProductID=32 ProductName=Mascarpone Fabioli Category=Dairy Products UnitPrice=32.0000 UnitsInStock=9 ProductID=49 ProductName=Maxilaku Category=Confections UnitPrice=20.0000 UnitsInStock=10 ProductID=9 ProductName=Mishi Kobe Niku Category=Meat/Poultry UnitPrice=97.0000 UnitsInStock=29 ProductID=72 ProductName=Mozzarella di Giovanni Category=Dairy Products UnitPrice=34.8000 UnitsInStock=14 ProductID=30 ProductName=Nord-Ost Matjeshering Category=Seafood UnitPrice=25.8900 UnitsInStock=10 ProductID=8 ProductName=Northwoods Cranberry Sauce Category=Condiments UnitPrice=40.0000 UnitsInStock=6 ProductID=25 ProductName=NuNuCa Nu-Nougat-Creme Category=Confections UnitPrice=14.0000 UnitsInStock=76 ProductID=77 ProductName=Original Frankfurter grne Soe Category=Condiments UnitPrice=13.0000 UnitsInStock=32 ProductID=70 ProductName=Outback Lager Category=Beverages UnitPrice=15.0000 UnitsInStock=15 ProductID=55 ProductName=Pt chinois Category=Meat/Poultry UnitPrice=24.0000 UnitsInStock=115 ProductID=16 ProductName=Pavlova Category=Confections UnitPrice=17.4500 UnitsInStock=29 ProductID=53 ProductName=Perth Pasties Category=Meat/Poultry UnitPrice=32.8000 UnitsInStock=0 ProductID=11 ProductName=Queso Cabrales Category=Dairy Products UnitPrice=21.0000 UnitsInStock=22 ProductID=12 ProductName=Queso Manchego La Pastora Category=Dairy Products UnitPrice=38.0000 UnitsInStock=86 ProductID=59 ProductName=Raclette Courdavault Category=Dairy Products UnitPrice=55.0000 UnitsInStock=79 ProductID=57 ProductName=Ravioli Angelo Category=Grains/Cereals UnitPrice=19.5000 UnitsInStock=36 ProductID=75 ProductName=Rhnbru Klosterbier Category=Beverages UnitPrice=7.7500 UnitsInStock=125 ProductID=73 ProductName=Rd Kaviar Category=Seafood UnitPrice=15.0000 UnitsInStock=101 ProductID=45 ProductName=Rogede sild Category=Seafood UnitPrice=9.5000 UnitsInStock=5 ProductID=28 ProductName=Rssle Sauerkraut Category=Produce UnitPrice=45.6000 UnitsInStock=26 ProductID=34 ProductName=Sasquatch Ale Category=Beverages UnitPrice=14.0000 UnitsInStock=111 ProductID=27 ProductName=Schoggi Schokolade Category=Confections UnitPrice=43.9000 UnitsInStock=49 ProductID=68 ProductName=Scottish Longbreads Category=Confections UnitPrice=12.5000 UnitsInStock=6 ProductID=42 ProductName=Singaporean Hokkien Fried Mee Category=Grains/Cereals UnitPrice=14.0000 UnitsInStock=26 ProductID=20 ProductName=Sir Rodney's Marmalade Category=Confections UnitPrice=81.0000 UnitsInStock=40 ProductID=21 ProductName=Sir Rodney's Scones Category=Confections UnitPrice=10.0000 UnitsInStock=3 ProductID=61 ProductName=Sirop d'rable Category=Condiments UnitPrice=28.5000 UnitsInStock=113 ProductID=46 ProductName=Spegesild Category=Seafood UnitPrice=12.0000 UnitsInStock=95 ProductID=35 ProductName=Steeleye Stout Category=Beverages UnitPrice=18.0000 UnitsInStock=20 ProductID=62 ProductName=Tarte au sucre Category=Confections UnitPrice=49.3000 UnitsInStock=17 ProductID=19 ProductName=Teatime Chocolate Biscuits Category=Confections UnitPrice=9.2000 UnitsInStock=25

ProductID=29 ProductName=Thringer Rostbratwurst Category=Meat/Poultry UnitPrice=123.7900 UnitsInStock=0 ProductID=14 ProductName=Tofu Category=Produce UnitPrice=23.2500 UnitsInStock=35 ProductID=54 ProductName=Tourtire Category=Meat/Poultry UnitPrice=7.4500 UnitsInStock=21 ProductID=23 ProductName=Tunnbrd Category=Grains/Cereals UnitPrice=9.0000 UnitsInStock=61 ProductID=7 ProductName=Uncle Bob's Organic Dried Pears Category=Produce UnitPrice=30.0000 UnitsInStock=15 ProductID=50 ProductName=Valkoinen suklaa Category=Confections UnitPrice=16.2500 UnitsInStock=65 ProductID=63 ProductName=Vegie-spread Category=Condiments UnitPrice=43.9000 UnitsInStock=24 ProductID=64 ProductName=Wimmers gute Semmelkndel Category=Grains/Cereals UnitPrice=33.2500 UnitsInStock=22 ProductID=47 ProductName=Zaanse koeken Category=Confections UnitPrice=9.5000 UnitsInStock=36

OrderBy - Comparer
This sample prints an array of strings, sorted according to a case insensitive alphanumeric sort. The sample uses OrderBy, passing a lambda function that performs the comparison. public class CaseInsensitiveComparer : IComparer<string> { public int Compare(string x, string y) { return string.Compare(x, y, true); } } public void Linq31() { string[] words = { "aPPLE", "AbAcUs", "bRaNcH", "BlUeBeRrY", "ClOvEr", "cHeRry"}; var sortedWords = words.OrderBy(a => a, new CaseInsensitiveComparer()); ObjectDumper.Write(sortedWords); } Result AbAcUs aPPLE BlUeBeRrY bRaNcH cHeRry ClOvEr

OrderByDescending - Simple 1
This sample prints a sorted version of an array of doubles. The numbers are printed in descending order. The sample uses orderby and descending to sort the numbers from highest to lowest. public void Linq32() { double[] doubles = { 1.7, 2.3, 1.9, 4.1, 2.9 };

var sortedDoubles = from d in doubles orderby d descending select d; Console.WriteLine("The doubles from highest to lowest:"); foreach (var d in sortedDoubles) { Console.WriteLine(d); } } Result The doubles from highest to lowest: 4.1 2.9 2.3 1.9 1.7

OrderByDescending - Simple 2
This sample prints a list of products sorted by the number of units of each product that are in stock. The sample uses orderby and descending to perform the sort. public void Linq33() { List products = GetProductList(); var sortedProducts = from p in products orderby p.UnitsInStock descending select p; ObjectDumper.Write(sortedProducts); } Result ProductID=75 ProductName=Rhnbru Klosterbier Category=Beverages UnitPrice=7.7500 UnitsInStock=125 ProductID=40 ProductName=Boston Crab Meat Category=Seafood UnitPrice=18.4000 UnitsInStock=123 ProductID=6 ProductName=Grandma's Boysenberry Spread Category=Condiments UnitPrice=25.0000 UnitsInStock=120 ProductID=55 ProductName=Pt chinois Category=Meat/Poultry UnitPrice=24.0000 UnitsInStock=115 ProductID=61 ProductName=Sirop d'rable Category=Condiments UnitPrice=28.5000 UnitsInStock=113 ProductID=36 ProductName=Inlagd Sill Category=Seafood UnitPrice=19.0000 UnitsInStock=112 ProductID=33 ProductName=Geitost Category=Dairy Products UnitPrice=2.5000 UnitsInStock=112 ProductID=34 ProductName=Sasquatch Ale Category=Beverages UnitPrice=14.0000 UnitsInStock=111 ProductID=22 ProductName=Gustaf's Knckebrd Category=Grains/Cereals UnitPrice=21.0000 UnitsInStock=104 ProductID=73 ProductName=Rd Kaviar Category=Seafood UnitPrice=15.0000 UnitsInStock=101 ProductID=46 ProductName=Spegesild Category=Seafood UnitPrice=12.0000 UnitsInStock=95 ProductID=12 ProductName=Queso Manchego La Pastora Category=Dairy Products UnitPrice=38.0000

UnitsInStock=86 ProductID=41 ProductName=Jack's New England Clam Chowder Category=Seafood UnitPrice=9.6500 UnitsInStock=85 ProductID=59 ProductName=Raclette Courdavault Category=Dairy Products UnitPrice=55.0000 UnitsInStock=79 ProductID=65 ProductName=Louisiana Fiery Hot Pepper Sauce Category=Condiments UnitPrice=21.0500 UnitsInStock=76 ProductID=25 ProductName=NuNuCa Nu-Nougat-Creme Category=Confections UnitPrice=14.0000 UnitsInStock=76 ProductID=39 ProductName=Chartreuse verte Category=Beverages UnitPrice=18.0000 UnitsInStock=69 ProductID=50 ProductName=Valkoinen suklaa Category=Confections UnitPrice=16.2500 UnitsInStock=65 ProductID=58 ProductName=Escargots de Bourgogne Category=Seafood UnitPrice=13.2500 UnitsInStock=62 ProductID=23 ProductName=Tunnbrd Category=Grains/Cereals UnitPrice=9.0000 UnitsInStock=61 ProductID=76 ProductName=Lakkalikri Category=Beverages UnitPrice=18.0000 UnitsInStock=57 ProductID=4 ProductName=Chef Anton's Cajun Seasoning Category=Condiments UnitPrice=22.0000 UnitsInStock=53 ProductID=67 ProductName=Laughing Lumberjack Lager Category=Beverages UnitPrice=14.0000 UnitsInStock=52 ProductID=27 ProductName=Schoggi Schokolade Category=Confections UnitPrice=43.9000 UnitsInStock=49 ProductID=18 ProductName=Carnarvon Tigers Category=Seafood UnitPrice=62.5000 UnitsInStock=42 ProductID=20 ProductName=Sir Rodney's Marmalade Category=Confections UnitPrice=81.0000 UnitsInStock=40 ProductID=1 ProductName=Chai Category=Beverages UnitPrice=18.0000 UnitsInStock=39 ProductID=15 ProductName=Genen Shouyu Category=Condiments UnitPrice=15.5000 UnitsInStock=39 ProductID=52 ProductName=Filo Mix Category=Grains/Cereals UnitPrice=7.0000 UnitsInStock=38 ProductID=57 ProductName=Ravioli Angelo Category=Grains/Cereals UnitPrice=19.5000 UnitsInStock=36 ProductID=47 ProductName=Zaanse koeken Category=Confections UnitPrice=9.5000 UnitsInStock=36 ProductID=14 ProductName=Tofu Category=Produce UnitPrice=23.2500 UnitsInStock=35 ProductID=77 ProductName=Original Frankfurter grne Soe Category=Condiments UnitPrice=13.0000 UnitsInStock=32 ProductID=10 ProductName=Ikura Category=Seafood UnitPrice=31.0000 UnitsInStock=31 ProductID=9 ProductName=Mishi Kobe Niku Category=Meat/Poultry UnitPrice=97.0000 UnitsInStock=29 ProductID=16 ProductName=Pavlova Category=Confections UnitPrice=17.4500 UnitsInStock=29 ProductID=44 ProductName=Gula Malacca Category=Condiments UnitPrice=19.4500 UnitsInStock=27 ProductID=42 ProductName=Singaporean Hokkien Fried Mee Category=Grains/Cereals UnitPrice=14.0000 UnitsInStock=26 ProductID=28 ProductName=Rssle Sauerkraut Category=Produce UnitPrice=45.6000 UnitsInStock=26 ProductID=71 ProductName=Flotemysost Category=Dairy Products UnitPrice=21.5000 UnitsInStock=26 ProductID=69 ProductName=Gudbrandsdalsost Category=Dairy Products UnitPrice=36.0000 UnitsInStock=26 ProductID=19 ProductName=Teatime Chocolate Biscuits Category=Confections UnitPrice=9.2000 UnitsInStock=25 ProductID=13 ProductName=Konbu Category=Seafood UnitPrice=6.0000 UnitsInStock=24 ProductID=63 ProductName=Vegie-spread Category=Condiments UnitPrice=43.9000 UnitsInStock=24 ProductID=64 ProductName=Wimmers gute Semmelkndel Category=Grains/Cereals UnitPrice=33.2500 UnitsInStock=22 ProductID=11 ProductName=Queso Cabrales Category=Dairy Products UnitPrice=21.0000 UnitsInStock=22 ProductID=54 ProductName=Tourtire Category=Meat/Poultry UnitPrice=7.4500 UnitsInStock=21 ProductID=56 ProductName=Gnocchi di nonna Alice Category=Grains/Cereals UnitPrice=38.0000 UnitsInStock=21 ProductID=51 ProductName=Manjimup Dried Apples Category=Produce UnitPrice=53.0000 UnitsInStock=20 ProductID=24 ProductName=Guaran Fantstica Category=Beverages UnitPrice=4.5000 UnitsInStock=20

ProductID=35 ProductName=Steeleye Stout Category=Beverages UnitPrice=18.0000 UnitsInStock=20 ProductID=60 ProductName=Camembert Pierrot Category=Dairy Products UnitPrice=34.0000 UnitsInStock=19 ProductID=62 ProductName=Tarte au sucre Category=Confections UnitPrice=49.3000 UnitsInStock=17 ProductID=2 ProductName=Chang Category=Beverages UnitPrice=19.0000 UnitsInStock=17 ProductID=38 ProductName=Cte de Blaye Category=Beverages UnitPrice=263.5000 UnitsInStock=17 ProductID=43 ProductName=Ipoh Coffee Category=Beverages UnitPrice=46.0000 UnitsInStock=17 ProductID=7 ProductName=Uncle Bob's Organic Dried Pears Category=Produce UnitPrice=30.0000 UnitsInStock=15 ProductID=48 ProductName=Chocolade Category=Confections UnitPrice=12.7500 UnitsInStock=15 ProductID=70 ProductName=Outback Lager Category=Beverages UnitPrice=15.0000 UnitsInStock=15 ProductID=26 ProductName=Gumbr Gummibrchen Category=Confections UnitPrice=31.2300 UnitsInStock=15 ProductID=72 ProductName=Mozzarella di Giovanni Category=Dairy Products UnitPrice=34.8000 UnitsInStock=14 ProductID=3 ProductName=Aniseed Syrup Category=Condiments UnitPrice=10.0000 UnitsInStock=13 ProductID=37 ProductName=Gravad lax Category=Seafood UnitPrice=26.0000 UnitsInStock=11 ProductID=30 ProductName=Nord-Ost Matjeshering Category=Seafood UnitPrice=25.8900 UnitsInStock=10 ProductID=49 ProductName=Maxilaku Category=Confections UnitPrice=20.0000 UnitsInStock=10 ProductID=32 ProductName=Mascarpone Fabioli Category=Dairy Products UnitPrice=32.0000 UnitsInStock=9 ProductID=68 ProductName=Scottish Longbreads Category=Confections UnitPrice=12.5000 UnitsInStock=6 ProductID=8 ProductName=Northwoods Cranberry Sauce Category=Condiments UnitPrice=40.0000 UnitsInStock=6 ProductID=45 ProductName=Rogede sild Category=Seafood UnitPrice=9.5000 UnitsInStock=5 ProductID=74 ProductName=Longlife Tofu Category=Produce UnitPrice=10.0000 UnitsInStock=4 ProductID=66 ProductName=Louisiana Hot Spiced Okra Category=Condiments UnitPrice=17.0000 UnitsInStock=4 ProductID=21 ProductName=Sir Rodney's Scones Category=Confections UnitPrice=10.0000 UnitsInStock=3 ProductID=31 ProductName=Gorgonzola Telino Category=Dairy Products UnitPrice=12.5000 UnitsInStock=0 ProductID=53 ProductName=Perth Pasties Category=Meat/Poultry UnitPrice=32.8000 UnitsInStock=0 ProductID=5 ProductName=Chef Anton's Gumbo Mix Category=Condiments UnitPrice=21.3500 UnitsInStock=0 ProductID=29 ProductName=Thringer Rostbratwurst Category=Meat/Poultry UnitPrice=123.7900 UnitsInStock=0 ProductID=17 ProductName=Alice Mutton Category=Meat/Poultry UnitPrice=39.0000 UnitsInStock=0

OrderByDescending - Comparer

This sample prints a sorted version of an array of strings. The output is sorted alphabetically in descending order, using a case insensitive comparision.

rerspan class="qs-keyword">string>

aNcH", "BlUeBeRrY", "ClOvEr", "cHeRry"};

(a => a, new CaseInsensitiveComparer());

Result ClOvEr cHeRry bRaNcH BlUeBeRrY aPPLE AbAcUs

ThenBy - Simple

This sample uses a compound orderby to sort a list of digits first by length of their name, and then alphabetically.

"three", "four", "five", "six", "seven", "eight", "nine" };

Result Sorted digits: one six two five four nine zero eight seven three

ThenBy - Comparer

This sample prints an array of string values sorted first by length, then sorted alphabetically, using a case-insentive comparison.

rerspan class="qs-keyword">string>

aNcH", "BlUeBeRrY", "ClOvEr", "cHeRry"};

sitiveComparer());

Result aPPLE AbAcUs bRaNcH cHeRry ClOvEr BlUeBeRrY

ThenByDescending - Simple

This sample uses a compound orderby to sort a list of products, first by category, and then by unit price, from highest to lowest.

edProducts =

ndingselect p;

Result ProductID=38 ProductName=Cte de Blaye Category=Beverages UnitPrice=263.5000 UnitsInStock=17 ProductID=43 ProductName=Ipoh Coffee Category=Beverages UnitPrice=46.0000 UnitsInStock=17 ProductID=2 ProductName=Chang Category=Beverages UnitPrice=19.0000 UnitsInStock=17 ProductID=35 ProductName=Steeleye Stout Category=Beverages UnitPrice=18.0000 UnitsInStock=20 ProductID=76 ProductName=Lakkalikri Category=Beverages UnitPrice=18.0000 UnitsInStock=57 ProductID=39 ProductName=Chartreuse verte Category=Beverages UnitPrice=18.0000 UnitsInStock=69 ProductID=1 ProductName=Chai Category=Beverages UnitPrice=18.0000 UnitsInStock=39 ProductID=70 ProductName=Outback Lager Category=Beverages UnitPrice=15.0000 UnitsInStock=15 ProductID=34 ProductName=Sasquatch Ale Category=Beverages UnitPrice=14.0000 UnitsInStock=111 ProductID=67 ProductName=Laughing Lumberjack Lager Category=Beverages UnitPrice=14.0000 UnitsInStock=52 ProductID=75 ProductName=Rhnbru Klosterbier Category=Beverages UnitPrice=7.7500 UnitsInStock=125 ProductID=24 ProductName=Guaran Fantstica Category=Beverages UnitPrice=4.5000 UnitsInStock=20 ProductID=63 ProductName=Vegie-spread Category=Condiments UnitPrice=43.9000 UnitsInStock=24 ProductID=8 ProductName=Northwoods Cranberry Sauce Category=Condiments UnitPrice=40.0000 UnitsInStock=6 ProductID=61 ProductName=Sirop d'rable Category=Condiments UnitPrice=28.5000 UnitsInStock=113 ProductID=6 ProductName=Grandma's Boysenberry Spread Category=Condiments UnitPrice=25.0000 UnitsInStock=120 ProductID=4 ProductName=Chef Anton's Cajun Seasoning Category=Condiments UnitPrice=22.0000 UnitsInStock=53

ProductID=5 ProductName=Chef Anton's Gumbo Mix Category=Condiments UnitPrice=21.3500 UnitsInStock=0 ProductID=65 ProductName=Louisiana Fiery Hot Pepper Sauce Category=Condiments UnitPrice=21.0500 UnitsInStock=76 ProductID=44 ProductName=Gula Malacca Category=Condiments UnitPrice=19.4500 UnitsInStock=27 ProductID=66 ProductName=Louisiana Hot Spiced Okra Category=Condiments UnitPrice=17.0000 UnitsInStock=4 ProductID=15 ProductName=Genen Shouyu Category=Condiments UnitPrice=15.5000 UnitsInStock=39 ProductID=77 ProductName=Original Frankfurter grne Soe Category=Condiments UnitPrice=13.0000 UnitsInStock=32 ProductID=3 ProductName=Aniseed Syrup Category=Condiments UnitPrice=10.0000 UnitsInStock=13 ProductID=20 ProductName=Sir Rodney's Marmalade Category=Confections UnitPrice=81.0000 UnitsInStock=40 ProductID=62 ProductName=Tarte au sucre Category=Confections UnitPrice=49.3000 UnitsInStock=17 ProductID=27 ProductName=Schoggi Schokolade Category=Confections UnitPrice=43.9000 UnitsInStock=49 ProductID=26 ProductName=Gumbr Gummibrchen Category=Confections UnitPrice=31.2300 UnitsInStock=15 ProductID=49 ProductName=Maxilaku Category=Confections UnitPrice=20.0000 UnitsInStock=10 ProductID=16 ProductName=Pavlova Category=Confections UnitPrice=17.4500 UnitsInStock=29 ProductID=50 ProductName=Valkoinen suklaa Category=Confections UnitPrice=16.2500 UnitsInStock=65 ProductID=25 ProductName=NuNuCa Nu-Nougat-Creme Category=Confections UnitPrice=14.0000 UnitsInStock=76 ProductID=48 ProductName=Chocolade Category=Confections UnitPrice=12.7500 UnitsInStock=15 ProductID=68 ProductName=Scottish Longbreads Category=Confections UnitPrice=12.5000 UnitsInStock=6 ProductID=21 ProductName=Sir Rodney's Scones Category=Confections UnitPrice=10.0000 UnitsInStock=3 ProductID=47 ProductName=Zaanse koeken Category=Confections UnitPrice=9.5000 UnitsInStock=36 ProductID=19 ProductName=Teatime Chocolate Biscuits Category=Confections UnitPrice=9.2000 UnitsInStock=25 ProductID=59 ProductName=Raclette Courdavault Category=Dairy Products UnitPrice=55.0000 UnitsInStock=79 ProductID=12 ProductName=Queso Manchego La Pastora Category=Dairy Products UnitPrice=38.0000 UnitsInStock=86 ProductID=69 ProductName=Gudbrandsdalsost Category=Dairy Products UnitPrice=36.0000 UnitsInStock=26 ProductID=72 ProductName=Mozzarella di Giovanni Category=Dairy Products UnitPrice=34.8000 UnitsInStock=14 ProductID=60 ProductName=Camembert Pierrot Category=Dairy Products UnitPrice=34.0000 UnitsInStock=19 ProductID=32 ProductName=Mascarpone Fabioli Category=Dairy Products UnitPrice=32.0000 UnitsInStock=9 ProductID=71 ProductName=Flotemysost Category=Dairy Products UnitPrice=21.5000 UnitsInStock=26 ProductID=11 ProductName=Queso Cabrales Category=Dairy Products UnitPrice=21.0000 UnitsInStock=22 ProductID=31 ProductName=Gorgonzola Telino Category=Dairy Products UnitPrice=12.5000 UnitsInStock=0 ProductID=33 ProductName=Geitost Category=Dairy Products UnitPrice=2.5000 UnitsInStock=112 ProductID=56 ProductName=Gnocchi di nonna Alice Category=Grains/Cereals UnitPrice=38.0000 UnitsInStock=21 ProductID=64 ProductName=Wimmers gute Semmelkndel Category=Grains/Cereals UnitPrice=33.2500 UnitsInStock=22 ProductID=22 ProductName=Gustaf's Knckebrd Category=Grains/Cereals UnitPrice=21.0000 UnitsInStock=104 ProductID=57 ProductName=Ravioli Angelo Category=Grains/Cereals UnitPrice=19.5000 UnitsInStock=36 ProductID=42 ProductName=Singaporean Hokkien Fried Mee Category=Grains/Cereals UnitPrice=14.0000 UnitsInStock=26 ProductID=23 ProductName=Tunnbrd Category=Grains/Cereals UnitPrice=9.0000 UnitsInStock=61 ProductID=52 ProductName=Filo Mix Category=Grains/Cereals UnitPrice=7.0000 UnitsInStock=38 ProductID=29 ProductName=Thringer Rostbratwurst Category=Meat/Poultry UnitPrice=123.7900 UnitsInStock=0 ProductID=9 ProductName=Mishi Kobe Niku Category=Meat/Poultry UnitPrice=97.0000 UnitsInStock=29 ProductID=17 ProductName=Alice Mutton Category=Meat/Poultry UnitPrice=39.0000 UnitsInStock=0 ProductID=53 ProductName=Perth Pasties Category=Meat/Poultry UnitPrice=32.8000 UnitsInStock=0

ProductID=55 ProductName=Pt chinois Category=Meat/Poultry UnitPrice=24.0000 UnitsInStock=115 ProductID=54 ProductName=Tourtire Category=Meat/Poultry UnitPrice=7.4500 UnitsInStock=21 ProductID=51 ProductName=Manjimup Dried Apples Category=Produce UnitPrice=53.0000 UnitsInStock=20 ProductID=28 ProductName=Rssle Sauerkraut Category=Produce UnitPrice=45.6000 UnitsInStock=26 ProductID=7 ProductName=Uncle Bob's Organic Dried Pears Category=Produce UnitPrice=30.0000 UnitsInStock=15 ProductID=14 ProductName=Tofu Category=Produce UnitPrice=23.2500 UnitsInStock=35 ProductID=74 ProductName=Longlife Tofu Category=Produce UnitPrice=10.0000 UnitsInStock=4 ProductID=18 ProductName=Carnarvon Tigers Category=Seafood UnitPrice=62.5000 UnitsInStock=42 ProductID=10 ProductName=Ikura Category=Seafood UnitPrice=31.0000 UnitsInStock=31 ProductID=37 ProductName=Gravad lax Category=Seafood UnitPrice=26.0000 UnitsInStock=11 ProductID=30 ProductName=Nord-Ost Matjeshering Category=Seafood UnitPrice=25.8900 UnitsInStock=10 ProductID=36 ProductName=Inlagd Sill Category=Seafood UnitPrice=19.0000 UnitsInStock=112 ProductID=40 ProductName=Boston Crab Meat Category=Seafood UnitPrice=18.4000 UnitsInStock=123 ProductID=73 ProductName=Rd Kaviar Category=Seafood UnitPrice=15.0000 UnitsInStock=101 ProductID=58 ProductName=Escargots de Bourgogne Category=Seafood UnitPrice=13.2500 UnitsInStock=62 ProductID=46 ProductName=Spegesild Category=Seafood UnitPrice=12.0000 UnitsInStock=95 ProductID=41 ProductName=Jack's New England Clam Chowder Category=Seafood UnitPrice=9.6500 UnitsInStock=85 ProductID=45 ProductName=Rogede sild Category=Seafood UnitPrice=9.5000 UnitsInStock=5 ProductID=13 ProductName=Konbu Category=Seafood UnitPrice=6.0000 UnitsInStock=24

ThenByDescending - Comparer

This sample uses an OrderBy and a ThenBy clause with a custom comparer to sort first by word length and then by a case-insensitive descending sort of the words in an array.

rerspan class="qs-keyword">string>

aNcH", "BlUeBeRrY", "ClOvEr", "cHeRry"};

CaseInsensitiveComparer());

Result aPPLE ClOvEr cHeRry bRaNcH AbAcUs BlUeBeRrY

Reverse

This sample prints a list strings from an input string array where each element has the second letter 'i'. The output list is printed in reverse order. The sample uses a query operator to gather the elements that have 'i' as the second letter and then reverses the sequence using the Reverse method.

"three", "four", "five", "six", "seven", "eight", "nine" };

e digits with a second character of 'i':");

Result A backwards list of the digits with a second character of 'i': nine eight six five

GroupBy - Simple 1
This sample uses group by to partition a list of numbers by their remainder when divided by 5. public void Linq40() { int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; var numberGroups = from n in numbers group n by n % 5 into g select new { Remainder = g.Key, Numbers = g }; foreach (var g in numberGroups) { Console.WriteLine("Numbers with a remainder of {0} when divided by 5:", g.Remainder); foreach (var n in g.Numbers) { Console.WriteLine(n); } } } Result Numbers with a remainder of 0 when divided by 5: 5 0 Numbers with a remainder of 4 when divided by 5: 4 9 Numbers with a remainder of 1 when divided by 5: 1 6 Numbers with a remainder of 3 when divided by 5: 3 8 Numbers with a remainder of 2 when divided by 5: 7 2

GroupBy - Simple 2
This sample partitions an array of words into groups according to the first letter of each word. The sample uses group by to perform the partitioning and select to create the anonymous class consisting of the first letter and group of words with the letter. public void Linq41() { string[] words = { "blueberry", "chimpanzee", "abacus", "banana", "apple", "cheese" };

var wordGroups = from w in words group w by w[0] into g select new { FirstLetter = g.Key, Words = g }; foreach (var g in wordGroups) { Console.WriteLine("Words that start with the letter '{0}':", g.FirstLetter); foreach (var w in g.Words) { Console.WriteLine(w); } } } Result Words that start with the letter 'b': blueberry banana Words that start with the letter 'c': chimpanzee cheese Words that start with the letter 'a': abacus apple

GroupBy - Simple 3
This sample uses group by to partition a list of products by category. public void Linq42() { List<Product> products = GetProductList(); var orderGroups = from p in products group p by p.Category into g select new { Category = g.Key, Products = g }; ObjectDumper.Write(orderGroups, 1); } Result Category=Beverages Products=... Products: ProductID=1 ProductName=Chai Category=Beverages UnitPrice=18.0000 UnitsInStock=39 Products: ProductID=2 ProductName=Chang Category=Beverages UnitPrice=19.0000 UnitsInStock=17 Products: ProductID=24 ProductName=Guaran Fantstica Category=Beverages UnitPrice=4.5000 UnitsInStock=20 Products: ProductID=34 ProductName=Sasquatch Ale Category=Beverages UnitPrice=14.0000 UnitsInStock=111 Products: ProductID=35 ProductName=Steeleye Stout Category=Beverages UnitPrice=18.0000 UnitsInStock=20 Products: ProductID=38 ProductName=Cte de Blaye Category=Beverages UnitPrice=263.5000 UnitsInStock=17 Products: ProductID=39 ProductName=Chartreuse verte Category=Beverages UnitPrice=18.0000 UnitsInStock=69 Products: ProductID=43 ProductName=Ipoh Coffee Category=Beverages UnitPrice=46.0000 UnitsInStock=17 Products: ProductID=67 ProductName=Laughing Lumberjack Lager Category=Beverages UnitPrice=14.0000

UnitsInStock=52 Products: ProductID=70 ProductName=Outback Lager Category=Beverages UnitPrice=15.0000 UnitsInStock=15 Products: ProductID=75 ProductName=Rhnbru Klosterbier Category=Beverages UnitPrice=7.7500 UnitsInStock=125 Products: ProductID=76 ProductName=Lakkalikri Category=Beverages UnitPrice=18.0000 UnitsInStock=57 Category=Condiments Products=... Products: ProductID=3 ProductName=Aniseed Syrup Category=Condiments UnitPrice=10.0000 UnitsInStock=13 Products: ProductID=4 ProductName=Chef Anton's Cajun Seasoning Category=Condiments UnitPrice=22.0000 UnitsInStock=53 Products: ProductID=5 ProductName=Chef Anton's Gumbo Mix Category=Condiments UnitPrice=21.3500 UnitsInStock=0 Products: ProductID=6 ProductName=Grandma's Boysenberry Spread Category=Condiments UnitPrice=25.0000 UnitsInStock=120 Products: ProductID=8 ProductName=Northwoods Cranberry Sauce Category=Condiments UnitPrice=40.0000 UnitsInStock=6 Products: ProductID=15 ProductName=Genen Shouyu Category=Condiments UnitPrice=15.5000 UnitsInStock=39 Products: ProductID=44 ProductName=Gula Malacca Category=Condiments UnitPrice=19.4500 UnitsInStock=27 Products: ProductID=61 ProductName=Sirop d'rable Category=Condiments UnitPrice=28.5000 UnitsInStock=113 Products: ProductID=63 ProductName=Vegie-spread Category=Condiments UnitPrice=43.9000 UnitsInStock=24 Products: ProductID=65 ProductName=Louisiana Fiery Hot Pepper Sauce Category=Condiments UnitPrice=21.0500 UnitsInStock=76 Products: ProductID=66 ProductName=Louisiana Hot Spiced Okra Category=Condiments UnitPrice=17.0000 UnitsInStock=4 Products: ProductID=77 ProductName=Original Frankfurter grne Soe Category=Condiments UnitPrice=13.0000 UnitsInStock=32 Category=Produce Products=... Products: ProductID=7 ProductName=Uncle Bob's Organic Dried Pears Category=Produce UnitPrice=30.0000 UnitsInStock=15 Products: ProductID=14 ProductName=Tofu Category=Produce UnitPrice=23.2500 UnitsInStock=35 Products: ProductID=28 ProductName=Rssle Sauerkraut Category=Produce UnitPrice=45.6000 UnitsInStock=26 Products: ProductID=51 ProductName=Manjimup Dried Apples Category=Produce UnitPrice=53.0000 UnitsInStock=20 Products: ProductID=74 ProductName=Longlife Tofu Category=Produce UnitPrice=10.0000 UnitsInStock=4 Category=Meat/Poultry Products=... Products: ProductID=9 ProductName=Mishi Kobe Niku Category=Meat/Poultry UnitPrice=97.0000 UnitsInStock=29 Products: ProductID=17 ProductName=Alice Mutton Category=Meat/Poultry UnitPrice=39.0000 UnitsInStock=0 Products: ProductID=29 ProductName=Thringer Rostbratwurst Category=Meat/Poultry UnitPrice=123.7900 UnitsInStock=0 Products: ProductID=53 ProductName=Perth Pasties Category=Meat/Poultry UnitPrice=32.8000 UnitsInStock=0 Products: ProductID=54 ProductName=Tourtire Category=Meat/Poultry UnitPrice=7.4500 UnitsInStock=21 Products: ProductID=55 ProductName=Pt chinois Category=Meat/Poultry UnitPrice=24.0000 UnitsInStock=115 Category=Seafood Products=... Products: ProductID=10 ProductName=Ikura Category=Seafood UnitPrice=31.0000 UnitsInStock=31 Products: ProductID=13 ProductName=Konbu Category=Seafood UnitPrice=6.0000 UnitsInStock=24 Products: ProductID=18 ProductName=Carnarvon Tigers Category=Seafood UnitPrice=62.5000 UnitsInStock=42 Products: ProductID=30 ProductName=Nord-Ost Matjeshering Category=Seafood UnitPrice=25.8900 UnitsInStock=10

Products: ProductID=36 ProductName=Inlagd Sill Category=Seafood UnitPrice=19.0000 UnitsInStock=112 Products: ProductID=37 ProductName=Gravad lax Category=Seafood UnitPrice=26.0000 UnitsInStock=11 Products: ProductID=40 ProductName=Boston Crab Meat Category=Seafood UnitPrice=18.4000 UnitsInStock=123 Products: ProductID=41 ProductName=Jack's New England Clam Chowder Category=Seafood UnitPrice=9.6500 UnitsInStock=85 Products: ProductID=45 ProductName=Rogede sild Category=Seafood UnitPrice=9.5000 UnitsInStock=5 Products: ProductID=46 ProductName=Spegesild Category=Seafood UnitPrice=12.0000 UnitsInStock=95 Products: ProductID=58 ProductName=Escargots de Bourgogne Category=Seafood UnitPrice=13.2500 UnitsInStock=62 Products: ProductID=73 ProductName=Rd Kaviar Category=Seafood UnitPrice=15.0000 UnitsInStock=101 Category=Dairy Products Products=... Products: ProductID=11 ProductName=Queso Cabrales Category=Dairy Products UnitPrice=21.0000 UnitsInStock=22 Products: ProductID=12 ProductName=Queso Manchego La Pastora Category=Dairy Products UnitPrice=38.0000 UnitsInStock=86 Products: ProductID=31 ProductName=Gorgonzola Telino Category=Dairy Products UnitPrice=12.5000 UnitsInStock=0 Products: ProductID=32 ProductName=Mascarpone Fabioli Category=Dairy Products UnitPrice=32.0000 UnitsInStock=9 Products: ProductID=33 ProductName=Geitost Category=Dairy Products UnitPrice=2.5000 UnitsInStock=112 Products: ProductID=59 ProductName=Raclette Courdavault Category=Dairy Products UnitPrice=55.0000 UnitsInStock=79 Products: ProductID=60 ProductName=Camembert Pierrot Category=Dairy Products UnitPrice=34.0000 UnitsInStock=19 Products: ProductID=69 ProductName=Gudbrandsdalsost Category=Dairy Products UnitPrice=36.0000 UnitsInStock=26 Products: ProductID=71 ProductName=Flotemysost Category=Dairy Products UnitPrice=21.5000 UnitsInStock=26 Products: ProductID=72 ProductName=Mozzarella di Giovanni Category=Dairy Products UnitPrice=34.8000 UnitsInStock=14 Category=Confections Products=... Products: ProductID=16 ProductName=Pavlova Category=Confections UnitPrice=17.4500 UnitsInStock=29 Products: ProductID=19 ProductName=Teatime Chocolate Biscuits Category=Confections UnitPrice=9.2000 UnitsInStock=25 Products: ProductID=20 ProductName=Sir Rodney's Marmalade Category=Confections UnitPrice=81.0000 UnitsInStock=40 Products: ProductID=21 ProductName=Sir Rodney's Scones Category=Confections UnitPrice=10.0000 UnitsInStock=3 Products: ProductID=25 ProductName=NuNuCa Nu-Nougat-Creme Category=Confections UnitPrice=14.0000 UnitsInStock=76 Products: ProductID=26 ProductName=Gumbr Gummibrchen Category=Confections UnitPrice=31.2300 UnitsInStock=15 Products: ProductID=27 ProductName=Schoggi Schokolade Category=Confections UnitPrice=43.9000 UnitsInStock=49 Products: ProductID=47 ProductName=Zaanse koeken Category=Confections UnitPrice=9.5000 UnitsInStock=36 Products: ProductID=48 ProductName=Chocolade Category=Confections UnitPrice=12.7500 UnitsInStock=15 Products: ProductID=49 ProductName=Maxilaku Category=Confections UnitPrice=20.0000 UnitsInStock=10 Products: ProductID=50 ProductName=Valkoinen suklaa Category=Confections UnitPrice=16.2500

UnitsInStock=65 Products: ProductID=62 ProductName=Tarte au sucre Category=Confections UnitPrice=49.3000 UnitsInStock=17 Products: ProductID=68 ProductName=Scottish Longbreads Category=Confections UnitPrice=12.5000 UnitsInStock=6 Category=Grains/Cereals Products=... Products: ProductID=22 ProductName=Gustaf's Knckebrd Category=Grains/Cereals UnitPrice=21.0000 UnitsInStock=104 Products: ProductID=23 ProductName=Tunnbrd Category=Grains/Cereals UnitPrice=9.0000 UnitsInStock=61 Products: ProductID=42 ProductName=Singaporean Hokkien Fried Mee Category=Grains/Cereals UnitPrice=14.0000 UnitsInStock=26 Products: ProductID=52 ProductName=Filo Mix Category=Grains/Cereals UnitPrice=7.0000 UnitsInStock=38 Products: ProductID=56 ProductName=Gnocchi di nonna Alice Category=Grains/Cereals UnitPrice=38.0000 UnitsInStock=21 Products: ProductID=57 ProductName=Ravioli Angelo Category=Grains/Cereals UnitPrice=19.5000 UnitsInStock=36 Products: ProductID=64 ProductName=Wimmers gute Semmelkndel Category=Grains/Cereals UnitPrice=33.2500 UnitsInStock=22

GroupBy - Nested
This sample uses group by to partition a list of each customer's orders, first by year, and then by month. public void Linq43() { List<Customer> customers = GetCustomerList(); var customerOrderGroups = from c in customers select new {c.CompanyName, YearGroups = from o in c.Orders group o by o.OrderDate.Year into yg select new {Year = yg.Key, MonthGroups = from o in yg group o by o.OrderDate.Month into mg select new { Month = mg.Key, Orders = mg } } }; ObjectDumper.Write(customerOrderGroups, 3); } Result CompanyName=Alfreds Futterkiste YearGroups=... YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=8 Orders=... Orders: OrderID=10643 OrderDate=8/25/1997 Total=814.50 MonthGroups: Month=10 Orders=...

Orders: OrderID=10692 OrderDate=10/3/1997 Total=878.00 Orders: OrderID=10702 OrderDate=10/13/1997 Total=330.00 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10835 OrderDate=1/15/1998 Total=845.80 MonthGroups: Month=3 Orders=... Orders: OrderID=10952 OrderDate=3/16/1998 Total=471.20 MonthGroups: Month=4 Orders=... Orders: OrderID=11011 OrderDate=4/9/1998 Total=933.50 CompanyName=Ana Trujillo Emparedados y helados YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=9 Orders=... Orders: OrderID=10308 OrderDate=9/18/1996 Total=88.80 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=8 Orders=... Orders: OrderID=10625 OrderDate=8/8/1997 Total=479.75 MonthGroups: Month=11 Orders=... Orders: OrderID=10759 OrderDate=11/28/1997 Total=320.00 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=3 Orders=... Orders: OrderID=10926 OrderDate=3/4/1998 Total=514.40 CompanyName=Antonio Moreno Taquera YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=11 Orders=... Orders: OrderID=10365 OrderDate=11/27/1996 Total=403.20 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=4 Orders=... Orders: OrderID=10507 OrderDate=4/15/1997 Total=749.06 MonthGroups: Month=5 Orders=... Orders: OrderID=10535 OrderDate=5/13/1997 Total=1940.85 MonthGroups: Month=6 Orders=... Orders: OrderID=10573 OrderDate=6/19/1997 Total=2082.00 MonthGroups: Month=9 Orders=... Orders: OrderID=10677 OrderDate=9/22/1997 Total=813.36 Orders: OrderID=10682 OrderDate=9/25/1997 Total=375.50 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10856 OrderDate=1/28/1998 Total=660.00 CompanyName=Around the Horn YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=11 Orders=... Orders: OrderID=10355 OrderDate=11/15/1996 Total=480.00 MonthGroups: Month=12 Orders=... Orders: OrderID=10383 OrderDate=12/16/1996 Total=899.00 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=2 Orders=... Orders: OrderID=10453 OrderDate=2/21/1997 Total=407.70

MonthGroups: Month=6 Orders=... Orders: OrderID=10558 OrderDate=6/4/1997 Total=2142.90 MonthGroups: Month=10 Orders=... Orders: OrderID=10707 OrderDate=10/16/1997 Total=1641.00 MonthGroups: Month=11 Orders=... Orders: OrderID=10741 OrderDate=11/14/1997 Total=228.00 Orders: OrderID=10743 OrderDate=11/17/1997 Total=319.20 MonthGroups: Month=12 Orders=... Orders: OrderID=10768 OrderDate=12/8/1997 Total=1477.00 Orders: OrderID=10793 OrderDate=12/24/1997 Total=191.10 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=2 Orders=... Orders: OrderID=10864 OrderDate=2/2/1998 Total=282.00 MonthGroups: Month=3 Orders=... Orders: OrderID=10920 OrderDate=3/3/1998 Total=390.00 Orders: OrderID=10953 OrderDate=3/16/1998 Total=4441.25 MonthGroups: Month=4 Orders=... Orders: OrderID=11016 OrderDate=4/10/1998 Total=491.50 CompanyName=Berglunds snabbkp YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=8 Orders=... Orders: OrderID=10278 OrderDate=8/12/1996 Total=1488.80 Orders: OrderID=10280 OrderDate=8/14/1996 Total=613.20 MonthGroups: Month=12 Orders=... Orders: OrderID=10384 OrderDate=12/16/1996 Total=2222.40 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=2 Orders=... Orders: OrderID=10444 OrderDate=2/12/1997 Total=1031.70 Orders: OrderID=10445 OrderDate=2/13/1997 Total=174.90 MonthGroups: Month=5 Orders=... Orders: OrderID=10524 OrderDate=5/1/1997 Total=3192.65 MonthGroups: Month=6 Orders=... Orders: OrderID=10572 OrderDate=6/18/1997 Total=1501.08 MonthGroups: Month=8 Orders=... Orders: OrderID=10626 OrderDate=8/11/1997 Total=1503.60 MonthGroups: Month=9 Orders=... Orders: OrderID=10654 OrderDate=9/2/1997 Total=601.83 Orders: OrderID=10672 OrderDate=9/17/1997 Total=3815.25 MonthGroups: Month=10 Orders=... Orders: OrderID=10689 OrderDate=10/1/1997 Total=472.50 MonthGroups: Month=11 Orders=... Orders: OrderID=10733 OrderDate=11/7/1997 Total=1459.00 MonthGroups: Month=12 Orders=... Orders: OrderID=10778 OrderDate=12/16/1997 Total=96.50 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10837 OrderDate=1/16/1998 Total=1064.50

Orders: OrderID=10857 OrderDate=1/28/1998 Total=2048.21 MonthGroups: Month=2 Orders=... Orders: OrderID=10866 OrderDate=2/3/1998 Total=1096.20 Orders: OrderID=10875 OrderDate=2/6/1998 Total=709.55 MonthGroups: Month=3 Orders=... Orders: OrderID=10924 OrderDate=3/4/1998 Total=1835.70 CompanyName=Blauer See Delikatessen YearGroups=... YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=4 Orders=... Orders: OrderID=10501 OrderDate=4/9/1997 Total=149.00 Orders: OrderID=10509 OrderDate=4/17/1997 Total=136.80 MonthGroups: Month=6 Orders=... Orders: OrderID=10582 OrderDate=6/27/1997 Total=330.00 MonthGroups: Month=7 Orders=... Orders: OrderID=10614 OrderDate=7/29/1997 Total=464.00 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10853 OrderDate=1/27/1998 Total=625.00 MonthGroups: Month=3 Orders=... Orders: OrderID=10956 OrderDate=3/17/1998 Total=677.00 MonthGroups: Month=4 Orders=... Orders: OrderID=11058 OrderDate=4/29/1998 Total=858.00 CompanyName=Blondel pre et fils YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=7 Orders=... Orders: OrderID=10265 OrderDate=7/25/1996 Total=1176.00 MonthGroups: Month=9 Orders=... Orders: OrderID=10297 OrderDate=9/4/1996 Total=1420.00 MonthGroups: Month=11 Orders=... Orders: OrderID=10360 OrderDate=11/22/1996 Total=7390.20 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=2 Orders=... Orders: OrderID=10436 OrderDate=2/5/1997 Total=1994.52 Orders: OrderID=10449 OrderDate=2/18/1997 Total=1838.20 MonthGroups: Month=6 Orders=... Orders: OrderID=10559 OrderDate=6/5/1997 Total=520.41 Orders: OrderID=10566 OrderDate=6/12/1997 Total=1761.00 Orders: OrderID=10584 OrderDate=6/30/1997 Total=593.75 MonthGroups: Month=8 Orders=... Orders: OrderID=10628 OrderDate=8/12/1997 Total=450.00 MonthGroups: Month=9 Orders=... Orders: OrderID=10679 OrderDate=9/23/1997 Total=660.00 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10826 OrderDate=1/12/1998 Total=730.00 CompanyName=Blido Comidas preparadas YearGroups=... YearGroups: Year=1996 MonthGroups=...

MonthGroups: Month=10 Orders=... Orders: OrderID=10326 OrderDate=10/10/1996 Total=982.00 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=12 Orders=... Orders: OrderID=10801 OrderDate=12/29/1997 Total=3026.85 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=3 Orders=... Orders: OrderID=10970 OrderDate=3/24/1998 Total=224.00 CompanyName=Bon app' YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=10 Orders=... Orders: OrderID=10331 OrderDate=10/16/1996 Total=88.50 Orders: OrderID=10340 OrderDate=10/29/1996 Total=2436.18 MonthGroups: Month=11 Orders=... Orders: OrderID=10362 OrderDate=11/25/1996 Total=1549.60 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=3 Orders=... Orders: OrderID=10470 OrderDate=3/11/1997 Total=1820.80 MonthGroups: Month=4 Orders=... Orders: OrderID=10511 OrderDate=4/18/1997 Total=2550.00 MonthGroups: Month=5 Orders=... Orders: OrderID=10525 OrderDate=5/2/1997 Total=818.40 MonthGroups: Month=9 Orders=... Orders: OrderID=10663 OrderDate=9/10/1997 Total=1930.40 MonthGroups: Month=10 Orders=... Orders: OrderID=10715 OrderDate=10/23/1997 Total=1296.00 MonthGroups: Month=11 Orders=... Orders: OrderID=10730 OrderDate=11/5/1997 Total=484.26 Orders: OrderID=10732 OrderDate=11/6/1997 Total=360.00 Orders: OrderID=10755 OrderDate=11/26/1997 Total=1948.50 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10827 OrderDate=1/12/1998 Total=843.00 MonthGroups: Month=2 Orders=... Orders: OrderID=10871 OrderDate=2/5/1998 Total=1979.23 Orders: OrderID=10876 OrderDate=2/9/1998 Total=917.00 MonthGroups: Month=3 Orders=... Orders: OrderID=10932 OrderDate=3/6/1998 Total=1788.63 Orders: OrderID=10940 OrderDate=3/11/1998 Total=360.00 MonthGroups: Month=5 Orders=... Orders: OrderID=11076 OrderDate=5/6/1998 Total=792.75 CompanyName=Bottom-Dollar Markets YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=12 Orders=... Orders: OrderID=10389 OrderDate=12/20/1996 Total=1832.80 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=1 Orders=...

Orders: OrderID=10410 OrderDate=1/10/1997 Total=802.00 Orders: OrderID=10411 OrderDate=1/10/1997 Total=966.80 Orders: OrderID=10431 OrderDate=1/30/1997 Total=1892.25 MonthGroups: Month=4 Orders=... Orders: OrderID=10492 OrderDate=4/1/1997 Total=851.20 MonthGroups: Month=11 Orders=... Orders: OrderID=10742 OrderDate=11/14/1997 Total=3118.00 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=3 Orders=... Orders: OrderID=10918 OrderDate=3/2/1998 Total=1447.50 Orders: OrderID=10944 OrderDate=3/12/1998 Total=1025.32 Orders: OrderID=10949 OrderDate=3/13/1998 Total=4422.00 Orders: OrderID=10975 OrderDate=3/25/1998 Total=717.50 Orders: OrderID=10982 OrderDate=3/27/1998 Total=1014.00 MonthGroups: Month=4 Orders=... Orders: OrderID=11027 OrderDate=4/16/1998 Total=877.72 Orders: OrderID=11045 OrderDate=4/23/1998 Total=1309.50 Orders: OrderID=11048 OrderDate=4/24/1998 Total=525.00 CompanyName=B's Beverages YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=8 Orders=... Orders: OrderID=10289 OrderDate=8/26/1996 Total=479.40 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=3 Orders=... Orders: OrderID=10471 OrderDate=3/11/1997 Total=1328.00 Orders: OrderID=10484 OrderDate=3/24/1997 Total=386.20 MonthGroups: Month=5 Orders=... Orders: OrderID=10538 OrderDate=5/15/1997 Total=139.80 Orders: OrderID=10539 OrderDate=5/16/1997 Total=355.50 MonthGroups: Month=6 Orders=... Orders: OrderID=10578 OrderDate=6/24/1997 Total=477.00 MonthGroups: Month=7 Orders=... Orders: OrderID=10599 OrderDate=7/15/1997 Total=493.00 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=3 Orders=... Orders: OrderID=10943 OrderDate=3/11/1998 Total=711.00 Orders: OrderID=10947 OrderDate=3/13/1998 Total=220.00 MonthGroups: Month=4 Orders=... Orders: OrderID=11023 OrderDate=4/14/1998 Total=1500.00 CompanyName=Cactus Comidas para llevar YearGroups=... YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=4 Orders=... Orders: OrderID=10521 OrderDate=4/29/1997 Total=225.50 MonthGroups: Month=12 Orders=... Orders: OrderID=10782 OrderDate=12/17/1997 Total=12.50 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=...

Orders: OrderID=10819 OrderDate=1/7/1998 Total=477.00 MonthGroups: Month=2 Orders=... Orders: OrderID=10881 OrderDate=2/11/1998 Total=150.00 MonthGroups: Month=3 Orders=... Orders: OrderID=10937 OrderDate=3/10/1998 Total=644.80 MonthGroups: Month=4 Orders=... Orders: OrderID=11054 OrderDate=4/28/1998 Total=305.00 CompanyName=Centro comercial Moctezuma YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=7 Orders=... Orders: OrderID=10259 OrderDate=7/18/1996 Total=100.80 CompanyName=Chop-suey Chinese YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=7 Orders=... Orders: OrderID=10254 OrderDate=7/11/1996 Total=556.62 MonthGroups: Month=12 Orders=... Orders: OrderID=10370 OrderDate=12/3/1996 Total=1117.60 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=4 Orders=... Orders: OrderID=10519 OrderDate=4/28/1997 Total=2314.20 MonthGroups: Month=11 Orders=... Orders: OrderID=10731 OrderDate=11/6/1997 Total=1890.50 Orders: OrderID=10746 OrderDate=11/19/1997 Total=2311.70 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=3 Orders=... Orders: OrderID=10966 OrderDate=3/20/1998 Total=1098.46 MonthGroups: Month=4 Orders=... Orders: OrderID=11029 OrderDate=4/16/1998 Total=1286.80 Orders: OrderID=11041 OrderDate=4/22/1998 Total=1773.00 CompanyName=Comrcio Mineiro YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=8 Orders=... Orders: OrderID=10290 OrderDate=8/27/1996 Total=2169.00 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=3 Orders=... Orders: OrderID=10466 OrderDate=3/6/1997 Total=216.00 MonthGroups: Month=4 Orders=... Orders: OrderID=10494 OrderDate=4/2/1997 Total=912.00 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=3 Orders=... Orders: OrderID=10969 OrderDate=3/23/1998 Total=108.00 MonthGroups: Month=4 Orders=... Orders: OrderID=11042 OrderDate=4/22/1998 Total=405.75 CompanyName=Consolidated Holdings YearGroups=... YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=2 Orders=... Orders: OrderID=10435 OrderDate=2/4/1997 Total=631.60

MonthGroups: Month=3 Orders=... Orders: OrderID=10462 OrderDate=3/3/1997 Total=156.00 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10848 OrderDate=1/23/1998 Total=931.50 CompanyName=Drachenblut Delikatessen YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=11 Orders=... Orders: OrderID=10363 OrderDate=11/26/1996 Total=447.20 MonthGroups: Month=12 Orders=... Orders: OrderID=10391 OrderDate=12/23/1996 Total=86.40 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=12 Orders=... Orders: OrderID=10797 OrderDate=12/25/1997 Total=420.00 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10825 OrderDate=1/9/1998 Total=1030.76 MonthGroups: Month=4 Orders=... Orders: OrderID=11036 OrderDate=4/20/1998 Total=1692.00 MonthGroups: Month=5 Orders=... Orders: OrderID=11067 OrderDate=5/4/1998 Total=86.85 CompanyName=Du monde entier YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=9 Orders=... Orders: OrderID=10311 OrderDate=9/20/1996 Total=268.80 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=7 Orders=... Orders: OrderID=10609 OrderDate=7/24/1997 Total=424.00 MonthGroups: Month=9 Orders=... Orders: OrderID=10683 OrderDate=9/26/1997 Total=63.00 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=2 Orders=... Orders: OrderID=10890 OrderDate=2/16/1998 Total=860.10 CompanyName=Eastern Connection YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=11 Orders=... Orders: OrderID=10364 OrderDate=11/26/1996 Total=950.00 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10400 OrderDate=1/1/1997 Total=3063.00 MonthGroups: Month=5 Orders=... Orders: OrderID=10532 OrderDate=5/9/1997 Total=796.35 MonthGroups: Month=11 Orders=... Orders: OrderID=10726 OrderDate=11/3/1997 Total=655.00 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=3 Orders=... Orders: OrderID=10987 OrderDate=3/31/1998 Total=2772.00

MonthGroups: Month=4 Orders=... Orders: OrderID=11024 OrderDate=4/15/1998 Total=1966.81 Orders: OrderID=11047 OrderDate=4/24/1998 Total=817.88 Orders: OrderID=11056 OrderDate=4/28/1998 Total=3740.00 CompanyName=Ernst Handel YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=7 Orders=... Orders: OrderID=10258 OrderDate=7/17/1996 Total=1614.88 Orders: OrderID=10263 OrderDate=7/23/1996 Total=1873.80 MonthGroups: Month=11 Orders=... Orders: OrderID=10351 OrderDate=11/11/1996 Total=5398.72 Orders: OrderID=10368 OrderDate=11/29/1996 Total=1689.78 MonthGroups: Month=12 Orders=... Orders: OrderID=10382 OrderDate=12/13/1996 Total=2900.00 Orders: OrderID=10390 OrderDate=12/23/1996 Total=2090.88 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10402 OrderDate=1/2/1997 Total=2713.50 Orders: OrderID=10403 OrderDate=1/3/1997 Total=855.02 Orders: OrderID=10430 OrderDate=1/30/1997 Total=4899.20 MonthGroups: Month=2 Orders=... Orders: OrderID=10442 OrderDate=2/11/1997 Total=1792.00 MonthGroups: Month=4 Orders=... Orders: OrderID=10514 OrderDate=4/22/1997 Total=8623.45 MonthGroups: Month=6 Orders=... Orders: OrderID=10571 OrderDate=6/17/1997 Total=550.59 MonthGroups: Month=7 Orders=... Orders: OrderID=10595 OrderDate=7/10/1997 Total=4725.00 MonthGroups: Month=8 Orders=... Orders: OrderID=10633 OrderDate=8/15/1997 Total=5510.59 MonthGroups: Month=9 Orders=... Orders: OrderID=10667 OrderDate=9/12/1997 Total=1536.80 MonthGroups: Month=10 Orders=... Orders: OrderID=10698 OrderDate=10/9/1997 Total=3436.44 MonthGroups: Month=12 Orders=... Orders: OrderID=10764 OrderDate=12/3/1997 Total=2286.00 Orders: OrderID=10771 OrderDate=12/10/1997 Total=344.00 Orders: OrderID=10773 OrderDate=12/11/1997 Total=2030.40 Orders: OrderID=10776 OrderDate=12/15/1997 Total=6635.28 Orders: OrderID=10795 OrderDate=12/24/1997 Total=2158.00 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10836 OrderDate=1/16/1998 Total=4705.50 Orders: OrderID=10854 OrderDate=1/27/1998 Total=2966.50 MonthGroups: Month=2 Orders=... Orders: OrderID=10895 OrderDate=2/18/1998 Total=6379.40 MonthGroups: Month=3 Orders=...

Orders: OrderID=10968 OrderDate=3/23/1998 Total=1408.00 Orders: OrderID=10979 OrderDate=3/26/1998 Total=4813.50 MonthGroups: Month=4 Orders=... Orders: OrderID=10990 OrderDate=4/1/1998 Total=4288.85 Orders: OrderID=11008 OrderDate=4/8/1998 Total=4680.90 Orders: OrderID=11017 OrderDate=4/13/1998 Total=6750.00 MonthGroups: Month=5 Orders=... Orders: OrderID=11072 OrderDate=5/5/1998 Total=5218.00 CompanyName=Familia Arquibaldo YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=11 Orders=... Orders: OrderID=10347 OrderDate=11/6/1996 Total=814.42 MonthGroups: Month=12 Orders=... Orders: OrderID=10386 OrderDate=12/18/1996 Total=166.00 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10414 OrderDate=1/14/1997 Total=224.83 MonthGroups: Month=4 Orders=... Orders: OrderID=10512 OrderDate=4/21/1997 Total=525.30 MonthGroups: Month=6 Orders=... Orders: OrderID=10581 OrderDate=6/26/1997 Total=310.00 MonthGroups: Month=8 Orders=... Orders: OrderID=10650 OrderDate=8/29/1997 Total=1779.20 MonthGroups: Month=10 Orders=... Orders: OrderID=10725 OrderDate=10/31/1997 Total=287.80 CompanyName=FISSA Fabrica Inter. Salchichas S.A. YearGroups=... CompanyName=Folies gourmandes YearGroups=... YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10408 OrderDate=1/8/1997 Total=1622.40 MonthGroups: Month=3 Orders=... Orders: OrderID=10480 OrderDate=3/20/1997 Total=756.00 MonthGroups: Month=8 Orders=... Orders: OrderID=10634 OrderDate=8/15/1997 Total=4985.50 MonthGroups: Month=12 Orders=... Orders: OrderID=10763 OrderDate=12/3/1997 Total=616.00 Orders: OrderID=10789 OrderDate=12/22/1997 Total=3687.00 CompanyName=Folk och f HB YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=7 Orders=... Orders: OrderID=10264 OrderDate=7/24/1996 Total=695.62 MonthGroups: Month=10 Orders=... Orders: OrderID=10327 OrderDate=10/11/1996 Total=1810.00 MonthGroups: Month=12 Orders=... Orders: OrderID=10378 OrderDate=12/10/1996 Total=103.20 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=2 Orders=...

Orders: OrderID=10434 OrderDate=2/3/1997 Total=321.12 Orders: OrderID=10460 OrderDate=2/28/1997 Total=176.10 MonthGroups: Month=5 Orders=... Orders: OrderID=10533 OrderDate=5/12/1997 Total=2222.20 MonthGroups: Month=6 Orders=... Orders: OrderID=10561 OrderDate=6/6/1997 Total=2844.50 MonthGroups: Month=10 Orders=... Orders: OrderID=10703 OrderDate=10/14/1997 Total=2545.00 MonthGroups: Month=12 Orders=... Orders: OrderID=10762 OrderDate=12/2/1997 Total=4337.00 Orders: OrderID=10774 OrderDate=12/11/1997 Total=868.75 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10824 OrderDate=1/9/1998 Total=250.80 MonthGroups: Month=2 Orders=... Orders: OrderID=10880 OrderDate=2/10/1998 Total=1500.00 Orders: OrderID=10902 OrderDate=2/23/1998 Total=863.43 MonthGroups: Month=3 Orders=... Orders: OrderID=10955 OrderDate=3/17/1998 Total=74.40 Orders: OrderID=10977 OrderDate=3/26/1998 Total=2233.00 Orders: OrderID=10980 OrderDate=3/27/1998 Total=248.00 MonthGroups: Month=4 Orders=... Orders: OrderID=10993 OrderDate=4/1/1998 Total=4895.44 Orders: OrderID=11001 OrderDate=4/6/1998 Total=2769.00 Orders: OrderID=11050 OrderDate=4/27/1998 Total=810.00 CompanyName=Frankenversand YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=7 Orders=... Orders: OrderID=10267 OrderDate=7/29/1996 Total=3536.60 MonthGroups: Month=10 Orders=... Orders: OrderID=10337 OrderDate=10/24/1996 Total=2467.00 Orders: OrderID=10342 OrderDate=10/30/1996 Total=1840.64 MonthGroups: Month=12 Orders=... Orders: OrderID=10396 OrderDate=12/27/1996 Total=1903.80 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=3 Orders=... Orders: OrderID=10488 OrderDate=3/27/1997 Total=1512.00 MonthGroups: Month=6 Orders=... Orders: OrderID=10560 OrderDate=6/6/1997 Total=1072.42 MonthGroups: Month=8 Orders=... Orders: OrderID=10623 OrderDate=8/7/1997 Total=1336.95 MonthGroups: Month=9 Orders=... Orders: OrderID=10653 OrderDate=9/2/1997 Total=1083.15 Orders: OrderID=10670 OrderDate=9/16/1997 Total=2301.75 Orders: OrderID=10675 OrderDate=9/19/1997 Total=1423.00 MonthGroups: Month=10 Orders=... Orders: OrderID=10717 OrderDate=10/24/1997 Total=1270.75

MonthGroups: Month=12 Orders=... Orders: OrderID=10791 OrderDate=12/23/1997 Total=1829.76 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10859 OrderDate=1/29/1998 Total=1078.69 MonthGroups: Month=3 Orders=... Orders: OrderID=10929 OrderDate=3/5/1998 Total=1174.75 MonthGroups: Month=4 Orders=... Orders: OrderID=11012 OrderDate=4/9/1998 Total=2825.30 CompanyName=France restauration YearGroups=... YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=9 Orders=... Orders: OrderID=10671 OrderDate=9/17/1997 Total=920.10 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10860 OrderDate=1/29/1998 Total=519.00 MonthGroups: Month=3 Orders=... Orders: OrderID=10971 OrderDate=3/24/1998 Total=1733.06 CompanyName=Franchi S.p.A. YearGroups=... YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10422 OrderDate=1/22/1997 Total=49.80 MonthGroups: Month=10 Orders=... Orders: OrderID=10710 OrderDate=10/20/1997 Total=93.50 MonthGroups: Month=11 Orders=... Orders: OrderID=10753 OrderDate=11/25/1997 Total=88.00 MonthGroups: Month=12 Orders=... Orders: OrderID=10807 OrderDate=12/31/1997 Total=18.40 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=4 Orders=... Orders: OrderID=11026 OrderDate=4/15/1998 Total=1030.00 Orders: OrderID=11060 OrderDate=4/30/1998 Total=266.00 CompanyName=Furia Bacalhau e Frutos do Mar YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=10 Orders=... Orders: OrderID=10328 OrderDate=10/14/1996 Total=1168.00 MonthGroups: Month=11 Orders=... Orders: OrderID=10352 OrderDate=11/12/1996 Total=136.30 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=3 Orders=... Orders: OrderID=10464 OrderDate=3/4/1997 Total=1609.28 Orders: OrderID=10491 OrderDate=3/31/1997 Total=259.50 MonthGroups: Month=5 Orders=... Orders: OrderID=10551 OrderDate=5/28/1997 Total=1677.30 MonthGroups: Month=7 Orders=... Orders: OrderID=10604 OrderDate=7/18/1997 Total=230.85 MonthGroups: Month=9 Orders=...

Orders: OrderID=10664 OrderDate=9/10/1997 Total=1288.39 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=3 Orders=... Orders: OrderID=10963 OrderDate=3/19/1998 Total=57.80 CompanyName=Galera del gastrnomo YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=11 Orders=... Orders: OrderID=10366 OrderDate=11/28/1996 Total=136.00 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10426 OrderDate=1/27/1997 Total=338.20 MonthGroups: Month=6 Orders=... Orders: OrderID=10568 OrderDate=6/13/1997 Total=155.00 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=2 Orders=... Orders: OrderID=10887 OrderDate=2/13/1998 Total=70.00 MonthGroups: Month=3 Orders=... Orders: OrderID=10928 OrderDate=3/5/1998 Total=137.50 CompanyName=Godos Cocina Tpica YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=9 Orders=... Orders: OrderID=10303 OrderDate=9/11/1996 Total=1117.80 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=5 Orders=... Orders: OrderID=10550 OrderDate=5/28/1997 Total=683.30 MonthGroups: Month=8 Orders=... Orders: OrderID=10629 OrderDate=8/12/1997 Total=2775.05 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=2 Orders=... Orders: OrderID=10872 OrderDate=2/5/1998 Total=2058.46 Orders: OrderID=10874 OrderDate=2/6/1998 Total=310.00 Orders: OrderID=10888 OrderDate=2/16/1998 Total=605.00 Orders: OrderID=10911 OrderDate=2/26/1998 Total=858.00 MonthGroups: Month=3 Orders=... Orders: OrderID=10948 OrderDate=3/13/1998 Total=2362.25 MonthGroups: Month=4 Orders=... Orders: OrderID=11009 OrderDate=4/8/1998 Total=616.50 Orders: OrderID=11037 OrderDate=4/21/1998 Total=60.00 CompanyName=Gourmet Lanchonetes YearGroups=... YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10423 OrderDate=1/23/1997 Total=1020.00 MonthGroups: Month=9 Orders=... Orders: OrderID=10652 OrderDate=9/1/1997 Total=318.84 Orders: OrderID=10685 OrderDate=9/29/1997 Total=801.10 MonthGroups: Month=10 Orders=... Orders: OrderID=10709 OrderDate=10/17/1997 Total=3424.00

MonthGroups: Month=11 Orders=... Orders: OrderID=10734 OrderDate=11/7/1997 Total=1498.35 MonthGroups: Month=12 Orders=... Orders: OrderID=10777 OrderDate=12/15/1997 Total=224.00 Orders: OrderID=10790 OrderDate=12/22/1997 Total=722.50 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=3 Orders=... Orders: OrderID=10959 OrderDate=3/18/1998 Total=131.75 MonthGroups: Month=4 Orders=... Orders: OrderID=11049 OrderDate=4/24/1998 Total=273.60 CompanyName=Great Lakes Food Market YearGroups=... YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=5 Orders=... Orders: OrderID=10528 OrderDate=5/6/1997 Total=392.20 MonthGroups: Month=7 Orders=... Orders: OrderID=10589 OrderDate=7/4/1997 Total=72.00 Orders: OrderID=10616 OrderDate=7/31/1997 Total=4807.00 Orders: OrderID=10617 OrderDate=7/31/1997 Total=1402.50 MonthGroups: Month=9 Orders=... Orders: OrderID=10656 OrderDate=9/4/1997 Total=604.22 Orders: OrderID=10681 OrderDate=9/25/1997 Total=1287.40 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10816 OrderDate=1/6/1998 Total=8446.45 MonthGroups: Month=3 Orders=... Orders: OrderID=10936 OrderDate=3/9/1998 Total=456.00 MonthGroups: Month=4 Orders=... Orders: OrderID=11006 OrderDate=4/7/1998 Total=329.68 Orders: OrderID=11040 OrderDate=4/22/1998 Total=200.00 Orders: OrderID=11061 OrderDate=4/30/1998 Total=510.00 CompanyName=GROSELLA-Restaurante YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=7 Orders=... Orders: OrderID=10268 OrderDate=7/30/1996 Total=1101.20 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=12 Orders=... Orders: OrderID=10785 OrderDate=12/18/1997 Total=387.50 CompanyName=Hanari Carnes YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=7 Orders=... Orders: OrderID=10250 OrderDate=7/8/1996 Total=1552.60 Orders: OrderID=10253 OrderDate=7/10/1996 Total=1444.80 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=5 Orders=... Orders: OrderID=10541 OrderDate=5/19/1997 Total=1946.52 MonthGroups: Month=8 Orders=... Orders: OrderID=10645 OrderDate=8/26/1997 Total=1535.00

MonthGroups: Month=10 Orders=... Orders: OrderID=10690 OrderDate=10/2/1997 Total=862.50 MonthGroups: Month=12 Orders=... Orders: OrderID=10770 OrderDate=12/9/1997 Total=236.25 Orders: OrderID=10783 OrderDate=12/18/1997 Total=1442.50 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=2 Orders=... Orders: OrderID=10886 OrderDate=2/13/1998 Total=3127.50 Orders: OrderID=10903 OrderDate=2/24/1998 Total=932.05 MonthGroups: Month=3 Orders=... Orders: OrderID=10922 OrderDate=3/3/1998 Total=742.50 Orders: OrderID=10925 OrderDate=3/4/1998 Total=475.15 Orders: OrderID=10981 OrderDate=3/27/1998 Total=15810.00 MonthGroups: Month=4 Orders=... Orders: OrderID=11022 OrderDate=4/14/1998 Total=1402.00 Orders: OrderID=11052 OrderDate=4/27/1998 Total=1332.00 CompanyName=HILARIN-Abastos YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=7 Orders=... Orders: OrderID=10257 OrderDate=7/16/1996 Total=1119.90 MonthGroups: Month=12 Orders=... Orders: OrderID=10395 OrderDate=12/26/1996 Total=2122.92 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=3 Orders=... Orders: OrderID=10476 OrderDate=3/17/1997 Total=180.48 Orders: OrderID=10486 OrderDate=3/26/1997 Total=1272.00 Orders: OrderID=10490 OrderDate=3/31/1997 Total=3163.20 MonthGroups: Month=4 Orders=... Orders: OrderID=10498 OrderDate=4/7/1997 Total=575.00 MonthGroups: Month=5 Orders=... Orders: OrderID=10552 OrderDate=5/29/1997 Total=880.50 MonthGroups: Month=7 Orders=... Orders: OrderID=10601 OrderDate=7/16/1997 Total=2285.00 Orders: OrderID=10613 OrderDate=7/29/1997 Total=353.20 MonthGroups: Month=8 Orders=... Orders: OrderID=10641 OrderDate=8/22/1997 Total=2054.00 MonthGroups: Month=10 Orders=... Orders: OrderID=10705 OrderDate=10/15/1997 Total=378.00 MonthGroups: Month=12 Orders=... Orders: OrderID=10796 OrderDate=12/25/1997 Total=2341.36 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=2 Orders=... Orders: OrderID=10863 OrderDate=2/2/1998 Total=441.15 Orders: OrderID=10901 OrderDate=2/23/1998 Total=934.50 MonthGroups: Month=3 Orders=... Orders: OrderID=10957 OrderDate=3/18/1998 Total=1762.70 Orders: OrderID=10960 OrderDate=3/19/1998 Total=265.35

Orders: OrderID=10976 OrderDate=3/25/1998 Total=912.00 MonthGroups: Month=4 Orders=... Orders: OrderID=11055 OrderDate=4/28/1998 Total=1727.50 CompanyName=Hungry Coyote Import Store YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=12 Orders=... Orders: OrderID=10375 OrderDate=12/6/1996 Total=338.00 Orders: OrderID=10394 OrderDate=12/25/1996 Total=442.00 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10415 OrderDate=1/15/1997 Total=102.40 MonthGroups: Month=7 Orders=... Orders: OrderID=10600 OrderDate=7/16/1997 Total=479.80 MonthGroups: Month=9 Orders=... Orders: OrderID=10660 OrderDate=9/8/1997 Total=1701.00 CompanyName=Hungry Owl All-Night Grocers YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=9 Orders=... Orders: OrderID=10298 OrderDate=9/5/1996 Total=2645.00 Orders: OrderID=10309 OrderDate=9/19/1996 Total=1762.00 MonthGroups: Month=10 Orders=... Orders: OrderID=10335 OrderDate=10/22/1996 Total=2036.16 MonthGroups: Month=12 Orders=... Orders: OrderID=10373 OrderDate=12/5/1996 Total=1366.40 Orders: OrderID=10380 OrderDate=12/12/1996 Total=1313.82 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10429 OrderDate=1/29/1997 Total=1441.38 MonthGroups: Month=4 Orders=... Orders: OrderID=10503 OrderDate=4/11/1997 Total=2048.50 Orders: OrderID=10516 OrderDate=4/24/1997 Total=2381.05 MonthGroups: Month=6 Orders=... Orders: OrderID=10567 OrderDate=6/12/1997 Total=2519.00 MonthGroups: Month=8 Orders=... Orders: OrderID=10646 OrderDate=8/27/1997 Total=1446.00 MonthGroups: Month=9 Orders=... Orders: OrderID=10661 OrderDate=9/9/1997 Total=562.60 Orders: OrderID=10687 OrderDate=9/30/1997 Total=4960.90 MonthGroups: Month=10 Orders=... Orders: OrderID=10701 OrderDate=10/13/1997 Total=2864.50 Orders: OrderID=10712 OrderDate=10/21/1997 Total=1233.48 MonthGroups: Month=11 Orders=... Orders: OrderID=10736 OrderDate=11/11/1997 Total=997.00 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=2 Orders=... Orders: OrderID=10897 OrderDate=2/19/1998 Total=10835.24 Orders: OrderID=10912 OrderDate=2/26/1998 Total=6200.55

MonthGroups: Month=3 Orders=... Orders: OrderID=10985 OrderDate=3/30/1998 Total=2023.38 MonthGroups: Month=4 Orders=... Orders: OrderID=11063 OrderDate=4/30/1998 Total=1342.95 CompanyName=Island Trading YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=9 Orders=... Orders: OrderID=10315 OrderDate=9/26/1996 Total=516.80 MonthGroups: Month=10 Orders=... Orders: OrderID=10318 OrderDate=10/1/1996 Total=240.40 Orders: OrderID=10321 OrderDate=10/3/1996 Total=144.00 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=3 Orders=... Orders: OrderID=10473 OrderDate=3/13/1997 Total=230.40 MonthGroups: Month=8 Orders=... Orders: OrderID=10621 OrderDate=8/5/1997 Total=758.50 MonthGroups: Month=9 Orders=... Orders: OrderID=10674 OrderDate=9/18/1997 Total=45.00 MonthGroups: Month=11 Orders=... Orders: OrderID=10749 OrderDate=11/20/1997 Total=1080.00 MonthGroups: Month=12 Orders=... Orders: OrderID=10798 OrderDate=12/26/1997 Total=446.60 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10829 OrderDate=1/13/1998 Total=1764.00 MonthGroups: Month=3 Orders=... Orders: OrderID=10933 OrderDate=3/6/1998 Total=920.60 CompanyName=Kniglich Essen YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=10 Orders=... Orders: OrderID=10323 OrderDate=10/7/1996 Total=164.40 Orders: OrderID=10325 OrderDate=10/9/1996 Total=1497.00 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=2 Orders=... Orders: OrderID=10456 OrderDate=2/25/1997 Total=557.60 Orders: OrderID=10457 OrderDate=2/25/1997 Total=1584.00 MonthGroups: Month=3 Orders=... Orders: OrderID=10468 OrderDate=3/7/1997 Total=717.60 MonthGroups: Month=4 Orders=... Orders: OrderID=10506 OrderDate=4/15/1997 Total=415.80 MonthGroups: Month=5 Orders=... Orders: OrderID=10542 OrderDate=5/20/1997 Total=469.11 MonthGroups: Month=8 Orders=... Orders: OrderID=10630 OrderDate=8/13/1997 Total=903.60 MonthGroups: Month=10 Orders=... Orders: OrderID=10718 OrderDate=10/27/1997 Total=3463.00 MonthGroups: Month=12 Orders=...

Orders: OrderID=10799 OrderDate=12/26/1997 Total=1553.50 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10817 OrderDate=1/6/1998 Total=10952.84 Orders: OrderID=10849 OrderDate=1/23/1998 Total=967.82 MonthGroups: Month=2 Orders=... Orders: OrderID=10893 OrderDate=2/18/1998 Total=5502.11 MonthGroups: Month=4 Orders=... Orders: OrderID=11028 OrderDate=4/16/1998 Total=2160.00 CompanyName=La corne d'abondance YearGroups=... YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10858 OrderDate=1/29/1998 Total=649.00 MonthGroups: Month=3 Orders=... Orders: OrderID=10927 OrderDate=3/5/1998 Total=800.00 Orders: OrderID=10972 OrderDate=3/24/1998 Total=251.50 Orders: OrderID=10973 OrderDate=3/24/1998 Total=291.55 CompanyName=La maison d'Asie YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=11 Orders=... Orders: OrderID=10350 OrderDate=11/11/1996 Total=642.06 Orders: OrderID=10358 OrderDate=11/20/1996 Total=429.40 MonthGroups: Month=12 Orders=... Orders: OrderID=10371 OrderDate=12/3/1996 Total=72.96 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10413 OrderDate=1/14/1997 Total=2123.20 Orders: OrderID=10425 OrderDate=1/24/1997 Total=360.00 MonthGroups: Month=2 Orders=... Orders: OrderID=10454 OrderDate=2/21/1997 Total=331.20 MonthGroups: Month=4 Orders=... Orders: OrderID=10493 OrderDate=4/2/1997 Total=608.40 Orders: OrderID=10500 OrderDate=4/9/1997 Total=523.26 MonthGroups: Month=7 Orders=... Orders: OrderID=10610 OrderDate=7/25/1997 Total=299.25 MonthGroups: Month=8 Orders=... Orders: OrderID=10631 OrderDate=8/14/1997 Total=55.80 MonthGroups: Month=12 Orders=... Orders: OrderID=10787 OrderDate=12/19/1997 Total=2622.76 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10832 OrderDate=1/14/1998 Total=475.11 MonthGroups: Month=3 Orders=... Orders: OrderID=10923 OrderDate=3/3/1998 Total=748.80 MonthGroups: Month=4 Orders=... Orders: OrderID=11051 OrderDate=4/27/1998 Total=36.00 CompanyName=Laughing Bacchus Wine Cellars YearGroups=...

YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=4 Orders=... Orders: OrderID=10495 OrderDate=4/3/1997 Total=278.00 MonthGroups: Month=8 Orders=... Orders: OrderID=10620 OrderDate=8/5/1997 Total=57.50 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10810 OrderDate=1/1/1998 Total=187.00 CompanyName=Lazy K Kountry Store YearGroups=... YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=3 Orders=... Orders: OrderID=10482 OrderDate=3/21/1997 Total=147.00 MonthGroups: Month=5 Orders=... Orders: OrderID=10545 OrderDate=5/22/1997 Total=210.00 CompanyName=Lehmanns Marktstand YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=8 Orders=... Orders: OrderID=10279 OrderDate=8/13/1996 Total=351.00 Orders: OrderID=10284 OrderDate=8/19/1996 Total=1170.38 MonthGroups: Month=10 Orders=... Orders: OrderID=10343 OrderDate=10/31/1996 Total=1584.00 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=4 Orders=... Orders: OrderID=10497 OrderDate=4/4/1997 Total=1380.60 Orders: OrderID=10522 OrderDate=4/30/1997 Total=2318.24 MonthGroups: Month=5 Orders=... Orders: OrderID=10534 OrderDate=5/12/1997 Total=465.70 Orders: OrderID=10536 OrderDate=5/14/1997 Total=1645.00 MonthGroups: Month=6 Orders=... Orders: OrderID=10557 OrderDate=6/3/1997 Total=1152.50 MonthGroups: Month=7 Orders=... Orders: OrderID=10592 OrderDate=7/8/1997 Total=516.47 Orders: OrderID=10593 OrderDate=7/9/1997 Total=1994.40 MonthGroups: Month=12 Orders=... Orders: OrderID=10772 OrderDate=12/10/1997 Total=3603.22 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10862 OrderDate=1/30/1998 Total=581.00 MonthGroups: Month=2 Orders=... Orders: OrderID=10891 OrderDate=2/17/1998 Total=368.93 MonthGroups: Month=3 Orders=... Orders: OrderID=10934 OrderDate=3/9/1998 Total=500.00 MonthGroups: Month=5 Orders=... Orders: OrderID=11070 OrderDate=5/5/1998 Total=1629.98 CompanyName=Let's Stop N Shop YearGroups=... YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=6 Orders=...

Orders: OrderID=10579 OrderDate=6/25/1997 Total=317.75 MonthGroups: Month=10 Orders=... Orders: OrderID=10719 OrderDate=10/27/1997 Total=844.25 MonthGroups: Month=11 Orders=... Orders: OrderID=10735 OrderDate=11/10/1997 Total=536.40 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=2 Orders=... Orders: OrderID=10884 OrderDate=2/12/1998 Total=1378.07 CompanyName=LILA-Supermercado YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=8 Orders=... Orders: OrderID=10283 OrderDate=8/16/1996 Total=1414.80 MonthGroups: Month=9 Orders=... Orders: OrderID=10296 OrderDate=9/3/1996 Total=1050.60 MonthGroups: Month=10 Orders=... Orders: OrderID=10330 OrderDate=10/16/1996 Total=1649.00 MonthGroups: Month=11 Orders=... Orders: OrderID=10357 OrderDate=11/19/1996 Total=1167.68 MonthGroups: Month=12 Orders=... Orders: OrderID=10381 OrderDate=12/12/1996 Total=112.00 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=2 Orders=... Orders: OrderID=10461 OrderDate=2/28/1997 Total=1538.70 MonthGroups: Month=4 Orders=... Orders: OrderID=10499 OrderDate=4/8/1997 Total=1412.00 MonthGroups: Month=5 Orders=... Orders: OrderID=10543 OrderDate=5/21/1997 Total=1504.50 MonthGroups: Month=12 Orders=... Orders: OrderID=10780 OrderDate=12/16/1997 Total=720.00 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10823 OrderDate=1/9/1998 Total=2826.00 MonthGroups: Month=2 Orders=... Orders: OrderID=10899 OrderDate=2/20/1998 Total=122.40 MonthGroups: Month=4 Orders=... Orders: OrderID=10997 OrderDate=4/3/1998 Total=1885.00 MonthGroups: Month=5 Orders=... Orders: OrderID=11065 OrderDate=5/1/1998 Total=189.42 Orders: OrderID=11071 OrderDate=5/5/1998 Total=484.50 CompanyName=LINO-Delicateses YearGroups=... YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10405 OrderDate=1/6/1997 Total=400.00 MonthGroups: Month=3 Orders=... Orders: OrderID=10485 OrderDate=3/25/1997 Total=1584.00 MonthGroups: Month=8 Orders=... Orders: OrderID=10638 OrderDate=8/20/1997 Total=2720.05

MonthGroups: Month=10 Orders=... Orders: OrderID=10697 OrderDate=10/8/1997 Total=805.42 MonthGroups: Month=11 Orders=... Orders: OrderID=10729 OrderDate=11/4/1997 Total=1850.00 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10811 OrderDate=1/2/1998 Total=852.00 Orders: OrderID=10838 OrderDate=1/19/1998 Total=1938.38 Orders: OrderID=10840 OrderDate=1/19/1998 Total=211.20 MonthGroups: Month=3 Orders=... Orders: OrderID=10919 OrderDate=3/2/1998 Total=1122.80 Orders: OrderID=10954 OrderDate=3/17/1998 Total=1659.54 MonthGroups: Month=4 Orders=... Orders: OrderID=11014 OrderDate=4/10/1998 Total=243.18 Orders: OrderID=11039 OrderDate=4/21/1998 Total=3090.00 CompanyName=Lonesome Pine Restaurant YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=9 Orders=... Orders: OrderID=10307 OrderDate=9/17/1996 Total=424.00 Orders: OrderID=10317 OrderDate=9/30/1996 Total=288.00 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=5 Orders=... Orders: OrderID=10544 OrderDate=5/21/1997 Total=417.20 MonthGroups: Month=9 Orders=... Orders: OrderID=10662 OrderDate=9/9/1997 Total=125.00 Orders: OrderID=10665 OrderDate=9/11/1997 Total=1295.00 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=2 Orders=... Orders: OrderID=10867 OrderDate=2/3/1998 Total=98.40 Orders: OrderID=10883 OrderDate=2/12/1998 Total=36.00 MonthGroups: Month=4 Orders=... Orders: OrderID=11018 OrderDate=4/13/1998 Total=1575.00 CompanyName=Magazzini Alimentari Riuniti YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=8 Orders=... Orders: OrderID=10275 OrderDate=8/7/1996 Total=291.84 MonthGroups: Month=9 Orders=... Orders: OrderID=10300 OrderDate=9/9/1996 Total=608.00 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10404 OrderDate=1/3/1997 Total=1591.25 MonthGroups: Month=3 Orders=... Orders: OrderID=10467 OrderDate=3/6/1997 Total=235.20 MonthGroups: Month=8 Orders=... Orders: OrderID=10635 OrderDate=8/18/1997 Total=1326.22 MonthGroups: Month=11 Orders=... Orders: OrderID=10754 OrderDate=11/25/1997 Total=55.20

MonthGroups: Month=12 Orders=... Orders: OrderID=10784 OrderDate=12/18/1997 Total=1488.00 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10818 OrderDate=1/7/1998 Total=833.00 MonthGroups: Month=3 Orders=... Orders: OrderID=10939 OrderDate=3/10/1998 Total=637.50 Orders: OrderID=10950 OrderDate=3/16/1998 Total=110.00 CompanyName=Maison Dewey YearGroups=... YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=5 Orders=... Orders: OrderID=10529 OrderDate=5/7/1997 Total=946.00 MonthGroups: Month=8 Orders=... Orders: OrderID=10649 OrderDate=8/28/1997 Total=1434.00 MonthGroups: Month=12 Orders=... Orders: OrderID=10760 OrderDate=12/1/1997 Total=2917.00 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=2 Orders=... Orders: OrderID=10892 OrderDate=2/17/1998 Total=2090.00 Orders: OrderID=10896 OrderDate=2/19/1998 Total=750.50 MonthGroups: Month=3 Orders=... Orders: OrderID=10978 OrderDate=3/26/1998 Total=1303.20 MonthGroups: Month=4 Orders=... Orders: OrderID=11004 OrderDate=4/7/1998 Total=295.38 CompanyName=Mre Paillarde YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=10 Orders=... Orders: OrderID=10332 OrderDate=10/17/1996 Total=1786.88 Orders: OrderID=10339 OrderDate=10/28/1996 Total=3354.00 MonthGroups: Month=12 Orders=... Orders: OrderID=10376 OrderDate=12/9/1996 Total=399.00 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10424 OrderDate=1/23/1997 Total=9194.56 MonthGroups: Month=2 Orders=... Orders: OrderID=10439 OrderDate=2/7/1997 Total=1078.00 MonthGroups: Month=4 Orders=... Orders: OrderID=10505 OrderDate=4/14/1997 Total=147.90 MonthGroups: Month=6 Orders=... Orders: OrderID=10565 OrderDate=6/11/1997 Total=639.90 Orders: OrderID=10570 OrderDate=6/17/1997 Total=2465.25 MonthGroups: Month=7 Orders=... Orders: OrderID=10590 OrderDate=7/7/1997 Total=1101.00 Orders: OrderID=10605 OrderDate=7/21/1997 Total=4109.70 MonthGroups: Month=8 Orders=... Orders: OrderID=10618 OrderDate=8/1/1997 Total=2697.50 Orders: OrderID=10619 OrderDate=8/4/1997 Total=1260.00

MonthGroups: Month=10 Orders=... Orders: OrderID=10724 OrderDate=10/30/1997 Total=638.50 CompanyName=Morgenstern Gesundkost YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=8 Orders=... Orders: OrderID=10277 OrderDate=8/9/1996 Total=1200.80 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=6 Orders=... Orders: OrderID=10575 OrderDate=6/20/1997 Total=2147.40 MonthGroups: Month=10 Orders=... Orders: OrderID=10699 OrderDate=10/9/1997 Total=114.00 MonthGroups: Month=12 Orders=... Orders: OrderID=10779 OrderDate=12/16/1997 Total=1335.00 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=3 Orders=... Orders: OrderID=10945 OrderDate=3/12/1998 Total=245.00 CompanyName=North/South YearGroups=... YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=4 Orders=... Orders: OrderID=10517 OrderDate=4/24/1997 Total=352.00 MonthGroups: Month=11 Orders=... Orders: OrderID=10752 OrderDate=11/24/1997 Total=252.00 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=4 Orders=... Orders: OrderID=11057 OrderDate=4/29/1998 Total=45.00 CompanyName=Ocano Atlntico Ltda. YearGroups=... YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10409 OrderDate=1/9/1997 Total=319.20 MonthGroups: Month=5 Orders=... Orders: OrderID=10531 OrderDate=5/8/1997 Total=110.00 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=2 Orders=... Orders: OrderID=10898 OrderDate=2/20/1998 Total=30.00 MonthGroups: Month=3 Orders=... Orders: OrderID=10958 OrderDate=3/18/1998 Total=781.00 Orders: OrderID=10986 OrderDate=3/30/1998 Total=2220.00 CompanyName=Old World Delicatessen YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=7 Orders=... Orders: OrderID=10260 OrderDate=7/19/1996 Total=1504.65 MonthGroups: Month=9 Orders=... Orders: OrderID=10305 OrderDate=9/13/1996 Total=3741.30 MonthGroups: Month=10 Orders=... Orders: OrderID=10338 OrderDate=10/25/1996 Total=934.50 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=2 Orders=...

Orders: OrderID=10441 OrderDate=2/10/1997 Total=1755.00 MonthGroups: Month=7 Orders=... Orders: OrderID=10594 OrderDate=7/9/1997 Total=565.50 MonthGroups: Month=9 Orders=... Orders: OrderID=10680 OrderDate=9/24/1997 Total=1261.88 MonthGroups: Month=10 Orders=... Orders: OrderID=10706 OrderDate=10/16/1997 Total=1893.00 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10855 OrderDate=1/27/1998 Total=2227.89 MonthGroups: Month=3 Orders=... Orders: OrderID=10965 OrderDate=3/20/1998 Total=848.00 MonthGroups: Month=4 Orders=... Orders: OrderID=11034 OrderDate=4/20/1998 Total=539.40 CompanyName=Ottilies Kseladen YearGroups=... YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10407 OrderDate=1/7/1997 Total=1194.00 MonthGroups: Month=4 Orders=... Orders: OrderID=10508 OrderDate=4/16/1997 Total=240.00 MonthGroups: Month=5 Orders=... Orders: OrderID=10554 OrderDate=5/30/1997 Total=1728.52 MonthGroups: Month=6 Orders=... Orders: OrderID=10580 OrderDate=6/26/1997 Total=1013.74 MonthGroups: Month=9 Orders=... Orders: OrderID=10684 OrderDate=9/26/1997 Total=1768.00 MonthGroups: Month=12 Orders=... Orders: OrderID=10766 OrderDate=12/5/1997 Total=2310.00 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10833 OrderDate=1/15/1998 Total=906.93 MonthGroups: Month=4 Orders=... Orders: OrderID=10999 OrderDate=4/3/1998 Total=1197.95 Orders: OrderID=11020 OrderDate=4/14/1998 Total=632.40 CompanyName=Paris spcialits YearGroups=... CompanyName=Pericles Comidas clsicas YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=10 Orders=... Orders: OrderID=10322 OrderDate=10/4/1996 Total=112.00 MonthGroups: Month=11 Orders=... Orders: OrderID=10354 OrderDate=11/14/1996 Total=568.80 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=3 Orders=... Orders: OrderID=10474 OrderDate=3/13/1997 Total=1249.10 MonthGroups: Month=4 Orders=... Orders: OrderID=10502 OrderDate=4/10/1997 Total=816.30 YearGroups: Year=1998 MonthGroups=...

MonthGroups: Month=4 Orders=... Orders: OrderID=10995 OrderDate=4/2/1998 Total=1196.00 MonthGroups: Month=5 Orders=... Orders: OrderID=11073 OrderDate=5/5/1998 Total=300.00 CompanyName=Piccolo und mehr YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=11 Orders=... Orders: OrderID=10353 OrderDate=11/13/1996 Total=8593.28 MonthGroups: Month=12 Orders=... Orders: OrderID=10392 OrderDate=12/24/1996 Total=1440.00 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10427 OrderDate=1/27/1997 Total=651.00 MonthGroups: Month=3 Orders=... Orders: OrderID=10489 OrderDate=3/28/1997 Total=439.20 MonthGroups: Month=5 Orders=... Orders: OrderID=10530 OrderDate=5/8/1997 Total=4180.00 MonthGroups: Month=7 Orders=... Orders: OrderID=10597 OrderDate=7/11/1997 Total=718.08 MonthGroups: Month=9 Orders=... Orders: OrderID=10686 OrderDate=9/30/1997 Total=1404.45 MonthGroups: Month=11 Orders=... Orders: OrderID=10747 OrderDate=11/19/1997 Total=1912.85 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10844 OrderDate=1/21/1998 Total=735.00 MonthGroups: Month=4 Orders=... Orders: OrderID=11053 OrderDate=4/27/1998 Total=3055.00 CompanyName=Princesa Isabel Vinhos YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=10 Orders=... Orders: OrderID=10336 OrderDate=10/23/1996 Total=285.12 MonthGroups: Month=12 Orders=... Orders: OrderID=10397 OrderDate=12/27/1996 Total=716.72 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=2 Orders=... Orders: OrderID=10433 OrderDate=2/3/1997 Total=851.20 MonthGroups: Month=3 Orders=... Orders: OrderID=10477 OrderDate=3/17/1997 Total=558.00 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10808 OrderDate=1/1/1998 Total=1411.00 MonthGroups: Month=4 Orders=... Orders: OrderID=11007 OrderDate=4/8/1998 Total=2633.90 CompanyName=Que Delcia YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=7 Orders=...

Orders: OrderID=10261 OrderDate=7/19/1996 Total=448.00 MonthGroups: Month=8 Orders=... Orders: OrderID=10291 OrderDate=8/27/1996 Total=497.52 MonthGroups: Month=12 Orders=... Orders: OrderID=10379 OrderDate=12/11/1996 Total=863.28 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10421 OrderDate=1/21/1997 Total=1194.27 MonthGroups: Month=7 Orders=... Orders: OrderID=10587 OrderDate=7/2/1997 Total=807.38 MonthGroups: Month=8 Orders=... Orders: OrderID=10647 OrderDate=8/27/1997 Total=636.00 MonthGroups: Month=10 Orders=... Orders: OrderID=10720 OrderDate=10/28/1997 Total=550.00 MonthGroups: Month=12 Orders=... Orders: OrderID=10794 OrderDate=12/24/1997 Total=314.76 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=3 Orders=... Orders: OrderID=10989 OrderDate=3/31/1998 Total=1353.60 CompanyName=Queen Cozinha YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=12 Orders=... Orders: OrderID=10372 OrderDate=12/4/1996 Total=9210.90 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10406 OrderDate=1/7/1997 Total=1830.78 MonthGroups: Month=3 Orders=... Orders: OrderID=10487 OrderDate=3/26/1997 Total=889.70 MonthGroups: Month=8 Orders=... Orders: OrderID=10637 OrderDate=8/19/1997 Total=2761.94 MonthGroups: Month=9 Orders=... Orders: OrderID=10659 OrderDate=9/5/1997 Total=1227.02 MonthGroups: Month=10 Orders=... Orders: OrderID=10704 OrderDate=10/14/1997 Total=595.50 MonthGroups: Month=11 Orders=... Orders: OrderID=10728 OrderDate=11/4/1997 Total=1296.75 MonthGroups: Month=12 Orders=... Orders: OrderID=10786 OrderDate=12/19/1997 Total=1531.08 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=2 Orders=... Orders: OrderID=10868 OrderDate=2/4/1998 Total=1920.60 Orders: OrderID=10913 OrderDate=2/26/1998 Total=768.75 Orders: OrderID=10914 OrderDate=2/27/1998 Total=537.50 MonthGroups: Month=3 Orders=... Orders: OrderID=10961 OrderDate=3/19/1998 Total=1119.90 MonthGroups: Month=5 Orders=... Orders: OrderID=11068 OrderDate=5/4/1998 Total=2027.08

CompanyName=QUICK-Stop YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=8 Orders=... Orders: OrderID=10273 OrderDate=8/5/1996 Total=2037.28 Orders: OrderID=10285 OrderDate=8/20/1996 Total=1743.36 Orders: OrderID=10286 OrderDate=8/21/1996 Total=3016.00 MonthGroups: Month=9 Orders=... Orders: OrderID=10313 OrderDate=9/24/1996 Total=182.40 MonthGroups: Month=11 Orders=... Orders: OrderID=10345 OrderDate=11/4/1996 Total=2924.80 Orders: OrderID=10361 OrderDate=11/22/1996 Total=2046.24 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10418 OrderDate=1/17/1997 Total=1814.80 MonthGroups: Month=2 Orders=... Orders: OrderID=10451 OrderDate=2/19/1997 Total=3849.66 MonthGroups: Month=4 Orders=... Orders: OrderID=10515 OrderDate=4/23/1997 Total=9921.30 MonthGroups: Month=5 Orders=... Orders: OrderID=10527 OrderDate=5/5/1997 Total=1503.00 Orders: OrderID=10540 OrderDate=5/19/1997 Total=10191.70 Orders: OrderID=10549 OrderDate=5/27/1997 Total=3554.28 MonthGroups: Month=7 Orders=... Orders: OrderID=10588 OrderDate=7/3/1997 Total=3120.00 MonthGroups: Month=9 Orders=... Orders: OrderID=10658 OrderDate=9/5/1997 Total=4464.60 MonthGroups: Month=10 Orders=... Orders: OrderID=10691 OrderDate=10/3/1997 Total=10164.80 Orders: OrderID=10694 OrderDate=10/6/1997 Total=4825.00 Orders: OrderID=10721 OrderDate=10/29/1997 Total=923.88 MonthGroups: Month=11 Orders=... Orders: OrderID=10745 OrderDate=11/18/1997 Total=4529.80 MonthGroups: Month=12 Orders=... Orders: OrderID=10765 OrderDate=12/4/1997 Total=1515.60 Orders: OrderID=10788 OrderDate=12/22/1997 Total=731.50 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10845 OrderDate=1/21/1998 Total=3812.70 MonthGroups: Month=2 Orders=... Orders: OrderID=10865 OrderDate=2/2/1998 Total=16387.50 Orders: OrderID=10878 OrderDate=2/10/1998 Total=1539.00 MonthGroups: Month=3 Orders=... Orders: OrderID=10938 OrderDate=3/10/1998 Total=2731.88 Orders: OrderID=10962 OrderDate=3/19/1998 Total=3584.00 MonthGroups: Month=4 Orders=... Orders: OrderID=10991 OrderDate=4/1/1998 Total=2296.00 Orders: OrderID=10996 OrderDate=4/2/1998 Total=560.00

Orders: OrderID=11021 OrderDate=4/14/1998 Total=6306.24 CompanyName=Rancho grande YearGroups=... YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=2 Orders=... Orders: OrderID=10448 OrderDate=2/17/1997 Total=443.40 MonthGroups: Month=10 Orders=... Orders: OrderID=10716 OrderDate=10/24/1997 Total=706.00 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10828 OrderDate=1/13/1998 Total=932.00 MonthGroups: Month=2 Orders=... Orders: OrderID=10916 OrderDate=2/27/1998 Total=686.70 MonthGroups: Month=4 Orders=... Orders: OrderID=11019 OrderDate=4/13/1998 Total=76.00 CompanyName=Rattlesnake Canyon Grocery YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=7 Orders=... Orders: OrderID=10262 OrderDate=7/22/1996 Total=584.00 MonthGroups: Month=8 Orders=... Orders: OrderID=10272 OrderDate=8/2/1996 Total=1456.00 Orders: OrderID=10294 OrderDate=8/30/1996 Total=1887.60 MonthGroups: Month=9 Orders=... Orders: OrderID=10314 OrderDate=9/25/1996 Total=2094.30 Orders: OrderID=10316 OrderDate=9/27/1996 Total=2835.00 MonthGroups: Month=11 Orders=... Orders: OrderID=10346 OrderDate=11/5/1996 Total=1618.88 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10401 OrderDate=1/1/1997 Total=3868.60 MonthGroups: Month=3 Orders=... Orders: OrderID=10479 OrderDate=3/19/1997 Total=10495.60 MonthGroups: Month=6 Orders=... Orders: OrderID=10564 OrderDate=6/10/1997 Total=1234.05 Orders: OrderID=10569 OrderDate=6/16/1997 Total=890.00 MonthGroups: Month=7 Orders=... Orders: OrderID=10598 OrderDate=7/14/1997 Total=2388.50 MonthGroups: Month=12 Orders=... Orders: OrderID=10761 OrderDate=12/2/1997 Total=507.00 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10820 OrderDate=1/7/1998 Total=1140.00 Orders: OrderID=10852 OrderDate=1/26/1998 Total=2984.00 MonthGroups: Month=2 Orders=... Orders: OrderID=10889 OrderDate=2/16/1998 Total=11380.00 MonthGroups: Month=3 Orders=... Orders: OrderID=10988 OrderDate=3/31/1998 Total=3574.80 MonthGroups: Month=4 Orders=...

Orders: OrderID=11000 OrderDate=4/6/1998 Total=903.75 MonthGroups: Month=5 Orders=... Orders: OrderID=11077 OrderDate=5/6/1998 Total=1255.72 CompanyName=Reggiani Caseifici YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=8 Orders=... Orders: OrderID=10288 OrderDate=8/23/1996 Total=80.10 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10428 OrderDate=1/28/1997 Total=192.00 MonthGroups: Month=2 Orders=... Orders: OrderID=10443 OrderDate=2/12/1997 Total=517.44 MonthGroups: Month=6 Orders=... Orders: OrderID=10562 OrderDate=6/9/1997 Total=488.70 MonthGroups: Month=7 Orders=... Orders: OrderID=10586 OrderDate=7/2/1997 Total=23.80 MonthGroups: Month=9 Orders=... Orders: OrderID=10655 OrderDate=9/3/1997 Total=154.40 MonthGroups: Month=11 Orders=... Orders: OrderID=10727 OrderDate=11/3/1997 Total=1624.50 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10812 OrderDate=1/2/1998 Total=1692.80 MonthGroups: Month=2 Orders=... Orders: OrderID=10908 OrderDate=2/26/1998 Total=663.10 MonthGroups: Month=3 Orders=... Orders: OrderID=10942 OrderDate=3/11/1998 Total=560.00 MonthGroups: Month=4 Orders=... Orders: OrderID=11010 OrderDate=4/9/1998 Total=645.00 Orders: OrderID=11062 OrderDate=4/30/1998 Total=406.40 CompanyName=Ricardo Adocicados YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=8 Orders=... Orders: OrderID=10287 OrderDate=8/22/1996 Total=819.00 MonthGroups: Month=9 Orders=... Orders: OrderID=10299 OrderDate=9/6/1996 Total=349.50 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=2 Orders=... Orders: OrderID=10447 OrderDate=2/14/1997 Total=914.40 MonthGroups: Month=3 Orders=... Orders: OrderID=10481 OrderDate=3/20/1997 Total=1472.00 MonthGroups: Month=6 Orders=... Orders: OrderID=10563 OrderDate=6/10/1997 Total=965.00 MonthGroups: Month=8 Orders=... Orders: OrderID=10622 OrderDate=8/6/1997 Total=560.00 Orders: OrderID=10648 OrderDate=8/28/1997 Total=372.38 YearGroups: Year=1998 MonthGroups=...

MonthGroups: Month=1 Orders=... Orders: OrderID=10813 OrderDate=1/5/1998 Total=602.40 Orders: OrderID=10851 OrderDate=1/26/1998 Total=2603.00 MonthGroups: Month=2 Orders=... Orders: OrderID=10877 OrderDate=2/9/1998 Total=1955.12 MonthGroups: Month=4 Orders=... Orders: OrderID=11059 OrderDate=4/29/1998 Total=1838.00 CompanyName=Richter Supermarkt YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=7 Orders=... Orders: OrderID=10255 OrderDate=7/12/1996 Total=2490.50 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10419 OrderDate=1/20/1997 Total=2097.60 MonthGroups: Month=5 Orders=... Orders: OrderID=10537 OrderDate=5/14/1997 Total=1823.80 MonthGroups: Month=9 Orders=... Orders: OrderID=10666 OrderDate=9/12/1997 Total=4666.94 MonthGroups: Month=11 Orders=... Orders: OrderID=10751 OrderDate=11/24/1997 Total=1631.48 Orders: OrderID=10758 OrderDate=11/28/1997 Total=1644.60 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=3 Orders=... Orders: OrderID=10931 OrderDate=3/6/1998 Total=799.20 Orders: OrderID=10951 OrderDate=3/16/1998 Total=458.76 MonthGroups: Month=4 Orders=... Orders: OrderID=11033 OrderDate=4/17/1998 Total=3232.80 MonthGroups: Month=5 Orders=... Orders: OrderID=11075 OrderDate=5/6/1998 Total=498.10 CompanyName=Romero y tomillo YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=8 Orders=... Orders: OrderID=10281 OrderDate=8/14/1996 Total=86.50 Orders: OrderID=10282 OrderDate=8/15/1996 Total=155.40 MonthGroups: Month=9 Orders=... Orders: OrderID=10306 OrderDate=9/16/1996 Total=498.50 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=3 Orders=... Orders: OrderID=10917 OrderDate=3/2/1998 Total=365.89 MonthGroups: Month=4 Orders=... Orders: OrderID=11013 OrderDate=4/9/1998 Total=361.00 CompanyName=Sant Gourmet YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=12 Orders=... Orders: OrderID=10387 OrderDate=12/18/1996 Total=1058.40 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=4 Orders=...

Orders: OrderID=10520 OrderDate=4/29/1997 Total=200.00 MonthGroups: Month=8 Orders=... Orders: OrderID=10639 OrderDate=8/20/1997 Total=500.00 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10831 OrderDate=1/14/1998 Total=2684.40 MonthGroups: Month=2 Orders=... Orders: OrderID=10909 OrderDate=2/26/1998 Total=670.00 MonthGroups: Month=4 Orders=... Orders: OrderID=11015 OrderDate=4/10/1998 Total=622.35 CompanyName=Save-a-lot Markets YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=10 Orders=... Orders: OrderID=10324 OrderDate=10/8/1996 Total=5275.72 MonthGroups: Month=12 Orders=... Orders: OrderID=10393 OrderDate=12/25/1996 Total=2556.95 Orders: OrderID=10398 OrderDate=12/30/1996 Total=2505.60 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=2 Orders=... Orders: OrderID=10440 OrderDate=2/10/1997 Total=4924.14 Orders: OrderID=10452 OrderDate=2/20/1997 Total=2018.50 MonthGroups: Month=4 Orders=... Orders: OrderID=10510 OrderDate=4/18/1997 Total=4707.54 MonthGroups: Month=6 Orders=... Orders: OrderID=10555 OrderDate=6/2/1997 Total=2944.40 MonthGroups: Month=7 Orders=... Orders: OrderID=10603 OrderDate=7/18/1997 Total=1483.00 Orders: OrderID=10607 OrderDate=7/22/1997 Total=6475.40 Orders: OrderID=10612 OrderDate=7/28/1997 Total=6375.00 MonthGroups: Month=8 Orders=... Orders: OrderID=10627 OrderDate=8/11/1997 Total=1185.75 MonthGroups: Month=9 Orders=... Orders: OrderID=10657 OrderDate=9/4/1997 Total=4371.60 Orders: OrderID=10678 OrderDate=9/23/1997 Total=5256.50 MonthGroups: Month=10 Orders=... Orders: OrderID=10700 OrderDate=10/10/1997 Total=1638.40 Orders: OrderID=10711 OrderDate=10/21/1997 Total=4451.70 Orders: OrderID=10713 OrderDate=10/22/1997 Total=2827.90 Orders: OrderID=10714 OrderDate=10/22/1997 Total=2205.75 Orders: OrderID=10722 OrderDate=10/29/1997 Total=1570.00 MonthGroups: Month=11 Orders=... Orders: OrderID=10748 OrderDate=11/20/1997 Total=2196.00 Orders: OrderID=10757 OrderDate=11/27/1997 Total=3082.00 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10815 OrderDate=1/5/1998 Total=40.00 Orders: OrderID=10847 OrderDate=1/22/1998 Total=4931.92

MonthGroups: Month=2 Orders=... Orders: OrderID=10882 OrderDate=2/11/1998 Total=892.64 Orders: OrderID=10894 OrderDate=2/18/1998 Total=2753.10 MonthGroups: Month=3 Orders=... Orders: OrderID=10941 OrderDate=3/11/1998 Total=4011.75 Orders: OrderID=10983 OrderDate=3/27/1998 Total=720.90 Orders: OrderID=10984 OrderDate=3/30/1998 Total=1809.75 MonthGroups: Month=4 Orders=... Orders: OrderID=11002 OrderDate=4/6/1998 Total=1811.10 Orders: OrderID=11030 OrderDate=4/17/1998 Total=12615.05 Orders: OrderID=11031 OrderDate=4/17/1998 Total=2393.50 MonthGroups: Month=5 Orders=... Orders: OrderID=11064 OrderDate=5/1/1998 Total=4330.40 CompanyName=Seven Seas Imports YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=11 Orders=... Orders: OrderID=10359 OrderDate=11/21/1996 Total=3471.68 MonthGroups: Month=12 Orders=... Orders: OrderID=10377 OrderDate=12/9/1996 Total=863.60 Orders: OrderID=10388 OrderDate=12/19/1996 Total=1228.80 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=3 Orders=... Orders: OrderID=10472 OrderDate=3/12/1997 Total=1036.80 MonthGroups: Month=5 Orders=... Orders: OrderID=10523 OrderDate=5/1/1997 Total=2444.31 Orders: OrderID=10547 OrderDate=5/23/1997 Total=1792.80 MonthGroups: Month=12 Orders=... Orders: OrderID=10800 OrderDate=12/26/1997 Total=1468.94 Orders: OrderID=10804 OrderDate=12/30/1997 Total=2278.40 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=2 Orders=... Orders: OrderID=10869 OrderDate=2/4/1998 Total=1630.00 CompanyName=Simons bistro YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=10 Orders=... Orders: OrderID=10341 OrderDate=10/29/1996 Total=352.60 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10417 OrderDate=1/16/1997 Total=11188.40 MonthGroups: Month=6 Orders=... Orders: OrderID=10556 OrderDate=6/3/1997 Total=835.20 MonthGroups: Month=8 Orders=... Orders: OrderID=10642 OrderDate=8/22/1997 Total=696.00 MonthGroups: Month=9 Orders=... Orders: OrderID=10669 OrderDate=9/15/1997 Total=570.00 MonthGroups: Month=12 Orders=... Orders: OrderID=10802 OrderDate=12/29/1997 Total=2942.81

YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=5 Orders=... Orders: OrderID=11074 OrderDate=5/6/1998 Total=232.08 CompanyName=Spcialits du monde YearGroups=... YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=11 Orders=... Orders: OrderID=10738 OrderDate=11/12/1997 Total=52.35 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=2 Orders=... Orders: OrderID=10907 Order Date=2/25/1998 Total=108.50 MonthGroups: Month=3 Orders=... Orders: OrderID=10964 OrderDate=3/20/1998 Total=2052.50 MonthGroups: Month=4 Orders=... Orders: OrderID=11043 OrderDate=4/22/1998 Total=210.00 CompanyName=Split Rail Beer & Ale YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=8 Orders=... Orders: OrderID=10271 OrderDate=8/1/1996 Total=48.00 MonthGroups: Month=10 Orders=... Orders: OrderID=10329 OrderDate=10/15/1996 Total=4578.43 MonthGroups: Month=11 Orders=... Orders: OrderID=10349 OrderDate=11/8/1996 Total=141.60 MonthGroups: Month=12 Orders=... Orders: OrderID=10369 OrderDate=12/2/1996 Total=2390.40 Orders: OrderID=10385 OrderDate=12/17/1996 Total=691.20 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10432 OrderDate=1/31/1997 Total=485.00 MonthGroups: Month=11 Orders=... Orders: OrderID=10756 OrderDate=11/27/1997 Total=1990.00 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10821 OrderDate=1/8/1998 Total=678.00 MonthGroups: Month=3 Orders=... Orders: OrderID=10974 OrderDate=3/25/1998 Total=439.00 CompanyName=Suprecirc;mes dlices YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=7 Orders=... Orders: OrderID=10252 OrderDate=7/9/1996 Total=3597.90 MonthGroups: Month=9 Orders=... Orders: OrderID=10302 OrderDate=9/10/1996 Total=2708.80 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=2 Orders=... Orders: OrderID=10458 OrderDate=2/26/1997 Total=3891.00 MonthGroups: Month=3 Orders=... Orders: OrderID=10463 OrderDate=3/4/1997 Total=713.30

Orders: OrderID=10475 OrderDate=3/14/1997 Total=1505.18 MonthGroups: Month=12 Orders=... Orders: OrderID=10767 OrderDate=12/5/1997 Total=28.00 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10841 OrderDate=1/20/1998 Total=4581.00 Orders: OrderID=10846 OrderDate=1/22/1998 Total=1112.00 MonthGroups: Month=2 Orders=... Orders: OrderID=10885 OrderDate=2/12/1998 Total=1209.00 MonthGroups: Month=3 Orders=... Orders: OrderID=10930 OrderDate=3/6/1998 Total=2255.50 MonthGroups: Month=4 Orders=... Orders: OrderID=11035 OrderDate=4/20/1998 Total=1754.50 Orders: OrderID=11038 OrderDate=4/21/1998 Total=732.60 CompanyName=The Big Cheese YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=9 Orders=... Orders: OrderID=10310 OrderDate=9/20/1996 Total=336.00 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=10 Orders=... Orders: OrderID=10708 OrderDate=10/17/1997 Total=180.40 MonthGroups: Month=12 Orders=... Orders: OrderID=10805 OrderDate=12/30/1997 Total=2775.00 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=4 Orders=... Orders: OrderID=10992 OrderDate=4/1/1998 Total=69.60 CompanyName=The Cracker Box YearGroups=... YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=8 Orders=... Orders: OrderID=10624 OrderDate=8/7/1997 Total=1393.24 MonthGroups: Month=12 Orders=... Orders: OrderID=10775 OrderDate=12/12/1997 Total=228.00 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=4 Orders=... Orders: OrderID=11003 OrderDate=4/6/1998 Total=326.00 CompanyName=Toms Spezialitten YearGroups=... YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=2 Orders=... Orders: OrderID=10438 OrderDate=2/6/1997 Total=454.00 Orders: OrderID=10446 OrderDate=2/14/1997 Total=246.24 MonthGroups: Month=5 Orders=... Orders: OrderID=10548 OrderDate=5/26/1997 Total=240.10 MonthGroups: Month=7 Orders=... Orders: OrderID=10608 OrderDate=7/23/1997 Total=1064.00 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=3 Orders=... Orders: OrderID=10967 OrderDate=3/23/1998 Total=910.40

CompanyName=Tortuga Restaurante YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=8 Orders=... Orders: OrderID=10276 OrderDate=8/8/1996 Total=420.00 Orders: OrderID=10293 OrderDate=8/29/1996 Total=848.70 MonthGroups: Month=9 Orders=... Orders: OrderID=10304 OrderDate=9/12/1996 Total=954.40 MonthGroups: Month=10 Orders=... Orders: OrderID=10319 OrderDate=10/2/1996 Total=1191.20 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=4 Orders=... Orders: OrderID=10518 OrderDate=4/25/1997 Total=4150.05 MonthGroups: Month=6 Orders=... Orders: OrderID=10576 OrderDate=6/23/1997 Total=838.45 MonthGroups: Month=9 Orders=... Orders: OrderID=10676 OrderDate=9/22/1997 Total=534.85 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10842 OrderDate=1/20/1998 Total=975.00 MonthGroups: Month=2 Orders=... Orders: OrderID=10915 OrderDate=2/27/1998 Total=539.50 MonthGroups: Month=5 Orders=... Orders: OrderID=11069 OrderDate=5/4/1998 Total=360.00 CompanyName=Tradiao Hipermercados YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=7 Orders=... Orders: OrderID=10249 OrderDate=7/5/1996 Total=1863.40 MonthGroups: Month=8 Orders=... Orders: OrderID=10292 OrderDate=8/28/1996 Total=1296.00 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=4 Orders=... Orders: OrderID=10496 OrderDate=4/4/1997 Total=190.00 MonthGroups: Month=7 Orders=... Orders: OrderID=10606 OrderDate=7/22/1997 Total=1130.40 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10830 OrderDate=1/13/1998 Total=1974.00 Orders: OrderID=10834 OrderDate=1/15/1998 Total=1432.71 Orders: OrderID=10839 OrderDate=1/19/1998 Total=827.55 CompanyName=Trail's Head Gourmet Provisioners YearGroups=... YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=6 Orders=... Orders: OrderID=10574 OrderDate=6/19/1997 Total=764.30 Orders: OrderID=10577 OrderDate=6/23/1997 Total=569.00 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10822 OrderDate=1/8/1998 Total=237.90

CompanyName=Vaffeljernet YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=11 Orders=... Orders: OrderID=10367 OrderDate=11/28/1996 Total=834.20 MonthGroups: Month=12 Orders=... Orders: OrderID=10399 OrderDate=12/31/1996 Total=1765.60 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=3 Orders=... Orders: OrderID=10465 OrderDate=3/5/1997 Total=2518.00 MonthGroups: Month=7 Orders=... Orders: OrderID=10591 OrderDate=7/7/1997 Total=812.50 Orders: OrderID=10602 OrderDate=7/17/1997 Total=48.75 MonthGroups: Month=10 Orders=... Orders: OrderID=10688 OrderDate=10/1/1997 Total=3160.60 MonthGroups: Month=11 Orders=... Orders: OrderID=10744 OrderDate=11/17/1997 Total=736.00 MonthGroups: Month=12 Orders=... Orders: OrderID=10769 OrderDate=12/8/1997 Total=1684.28 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=3 Orders=... Orders: OrderID=10921 OrderDate=3/3/1998 Total=1936.00 Orders: OrderID=10946 OrderDate=3/12/1998 Total=1407.50 MonthGroups: Month=4 Orders=... Orders: OrderID=10994 OrderDate=4/2/1998 Total=940.50 CompanyName=Victuailles en stock YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=7 Orders=... Orders: OrderID=10251 OrderDate=7/8/1996 Total=654.06 MonthGroups: Month=10 Orders=... Orders: OrderID=10334 OrderDate=10/21/1996 Total=144.80 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=2 Orders=... Orders: OrderID=10450 OrderDate=2/19/1997 Total=425.12 Orders: OrderID=10459 OrderDate=2/27/1997 Total=1659.20 MonthGroups: Month=3 Orders=... Orders: OrderID=10478 OrderDate=3/18/1997 Total=471.20 MonthGroups: Month=5 Orders=... Orders: OrderID=10546 OrderDate=5/23/1997 Total=2812.00 MonthGroups: Month=12 Orders=... Orders: OrderID=10806 OrderDate=12/31/1997 Total=439.60 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10814 OrderDate=1/5/1998 Total=1788.45 Orders: OrderID=10843 OrderDate=1/21/1998 Total=159.00 Orders: OrderID=10850 OrderDate=1/23/1998 Total=629.00 CompanyName=Vins et alcools Chevalier YearGroups=... YearGroups: Year=1996 MonthGroups=...

MonthGroups: Month=8 Orders=... Orders: OrderID=10274 OrderDate=8/6/1996 Total=538.60 MonthGroups: Month=9 Orders=... Orders: OrderID=10295 OrderDate=9/2/1996 Total=121.60 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=11 Orders=... Orders: OrderID=10737 OrderDate=11/11/1997 Total=139.80 Orders: OrderID=10739 OrderDate=11/12/1997 Total=240.00 CompanyName=Die Wandernde Kuh YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=9 Orders=... Orders: OrderID=10301 OrderDate=9/9/1996 Total=755.00 Orders: OrderID=10312 OrderDate=9/23/1996 Total=1614.80 MonthGroups: Month=11 Orders=... Orders: OrderID=10348 OrderDate=11/7/1996 Total=363.60 Orders: OrderID=10356 OrderDate=11/18/1996 Total=1106.40 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=4 Orders=... Orders: OrderID=10513 OrderDate=4/22/1997 Total=1942.00 MonthGroups: Month=8 Orders=... Orders: OrderID=10632 OrderDate=8/14/1997 Total=589.00 Orders: OrderID=10640 OrderDate=8/21/1997 Total=708.75 MonthGroups: Month=9 Orders=... Orders: OrderID=10651 OrderDate=9/1/1997 Total=397.80 Orders: OrderID=10668 OrderDate=9/15/1997 Total=625.28 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=4 Orders=... Orders: OrderID=11046 OrderDate=4/23/1998 Total=1485.80 CompanyName=Wartian Herkku YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=7 Orders=... Orders: OrderID=10266 OrderDate=7/26/1996 Total=346.56 MonthGroups: Month=8 Orders=... Orders: OrderID=10270 OrderDate=8/1/1996 Total=1376.00 MonthGroups: Month=10 Orders=... Orders: OrderID=10320 OrderDate=10/3/1996 Total=516.00 Orders: OrderID=10333 OrderDate=10/18/1996 Total=877.20 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10412 OrderDate=1/13/1997 Total=334.80 Orders: OrderID=10416 OrderDate=1/16/1997 Total=720.00 MonthGroups: Month=2 Orders=... Orders: OrderID=10437 OrderDate=2/5/1997 Total=393.00 Orders: OrderID=10455 OrderDate=2/24/1997 Total=2684.00 MonthGroups: Month=5 Orders=... Orders: OrderID=10526 OrderDate=5/5/1997 Total=1151.40 Orders: OrderID=10553 OrderDate=5/30/1997 Total=1546.30

MonthGroups: Month=6 Orders=... Orders: OrderID=10583 OrderDate=6/30/1997 Total=2237.50 MonthGroups: Month=8 Orders=... Orders: OrderID=10636 OrderDate=8/19/1997 Total=629.50 MonthGroups: Month=11 Orders=... Orders: OrderID=10750 OrderDate=11/21/1997 Total=1590.56 MonthGroups: Month=12 Orders=... Orders: OrderID=10781 OrderDate=12/17/1997 Total=975.88 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=4 Orders=... Orders: OrderID=11025 OrderDate=4/15/1998 Total=270.00 CompanyName=Wellington Importadora YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=7 Orders=... Orders: OrderID=10256 OrderDate=7/15/1996 Total=517.80 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10420 OrderDate=1/21/1997 Total=1707.84 MonthGroups: Month=7 Orders=... Orders: OrderID=10585 OrderDate=7/1/1997 Total=142.50 MonthGroups: Month=8 Orders=... Orders: OrderID=10644 OrderDate=8/25/1997 Total=1371.80 MonthGroups: Month=12 Orders=... Orders: OrderID=10803 OrderDate=12/30/1997 Total=1193.01 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10809 OrderDate=1/1/1998 Total=140.00 MonthGroups: Month=2 Orders=... Orders: OrderID=10900 OrderDate=2/20/1998 Total=33.75 Orders: OrderID=10905 OrderDate=2/24/1998 Total=342.00 MonthGroups: Month=3 Orders=... Orders: OrderID=10935 OrderDate=3/9/1998 Total=619.50 CompanyName=White Clover Markets YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=7 Orders=... Orders: OrderID=10269 OrderDate=7/31/1996 Total=642.20 MonthGroups: Month=11 Orders=... Orders: OrderID=10344 OrderDate=11/1/1996 Total=2296.00 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=3 Orders=... Orders: OrderID=10469 OrderDate=3/10/1997 Total=956.68 Orders: OrderID=10483 OrderDate=3/24/1997 Total=668.80 MonthGroups: Month=4 Orders=... Orders: OrderID=10504 OrderDate=4/11/1997 Total=1388.50 MonthGroups: Month=7 Orders=... Orders: OrderID=10596 OrderDate=7/11/1997 Total=1180.88 MonthGroups: Month=10 Orders=...

Orders: OrderID=10693 OrderDate=10/6/1997 Total=2071.20 Orders: OrderID=10696 OrderDate=10/8/1997 Total=996.00 Orders: OrderID=10723 OrderDate=10/30/1997 Total=468.45 MonthGroups: Month=11 Orders=... Orders: OrderID=10740 OrderDate=11/13/1997 Total=1416.00 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=1 Orders=... Orders: OrderID=10861 OrderDate=1/30/1998 Total=3523.40 MonthGroups: Month=2 Orders=... Orders: OrderID=10904 OrderDate=2/24/1998 Total=1924.25 MonthGroups: Month=4 Orders=... Orders: OrderID=11032 OrderDate=4/17/1998 Total=8902.50 MonthGroups: Month=5 Orders=... Orders: OrderID=11066 OrderDate=5/1/1998 Total=928.75 CompanyName=Wilman Kala YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=7 Orders=... Orders: OrderID=10248 OrderDate=7/4/1996 Total=440.00 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=7 Orders=... Orders: OrderID=10615 OrderDate=7/30/1997 Total=120.00 MonthGroups: Month=9 Orders=... Orders: OrderID=10673 OrderDate=9/18/1997 Total=412.35 MonthGroups: Month=10 Orders=... Orders: OrderID=10695 OrderDate=10/7/1997 Total=642.00 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=2 Orders=... Orders: OrderID=10873 OrderDate=2/6/1998 Total=336.80 Orders: OrderID=10879 OrderDate=2/10/1998 Total=611.30 Orders: OrderID=10910 OrderDate=2/26/1998 Total=452.90 MonthGroups: Month=4 Orders=... Orders: OrderID=11005 OrderDate=4/7/1998 Total=586.00 CompanyName=Wolski Zajazd YearGroups=... YearGroups: Year=1996 MonthGroups=... MonthGroups: Month=12 Orders=... Orders: OrderID=10374 OrderDate=12/5/1996 Total=459.00 YearGroups: Year=1997 MonthGroups=... MonthGroups: Month=7 Orders=... Orders: OrderID=10611 OrderDate=7/25/1997 Total=808.00 MonthGroups: Month=12 Orders=... Orders: OrderID=10792 OrderDate=12/23/1997 Total=399.85 YearGroups: Year=1998 MonthGroups=... MonthGroups: Month=2 Orders=... Orders: OrderID=10870 OrderDate=2/4/1998 Total=160.00 Orders: OrderID=10906 OrderDate=2/25/1998 Total=427.50 MonthGroups: Month=4 Orders=...

Orders: OrderID=10998 OrderDate=4/3/1998 Total=686.00 Orders: OrderID=11044 OrderDate=4/23/1998 Total=591.60

GroupBy - Comparer

This sample displays which elements from an input string array have the same letters. The sample used GroupBy and an AnagramEqualityComparer class to group the elements into those with the same letters. public class AnagramEqualityComparer : IEqualityComparerspan class="qs-keyword">string> { publicbool Equals(string x, string y) { return getCanonicalString(x) == getCanonicalString(y); } publicint GetHashCode(string obj) { return getCanonicalString(obj).GetHashCode(); } privatestring getCanonicalString(string word) { char[] wordChars = word.ToCharArray(); Array.Sortspan class="qs-keyword">char>(wordChars); returnnewstring(wordChars); } } publicvoid Linq44() { string[] anagrams = {"from ", " salt", " earn ", " last ", " near ", " form "}; var orderGroups = anagrams.GroupBy(w => w.Trim(), new AnagramEqualityComparer()); ObjectDumper.Write(orderGroups, 1); } Result Key=from Group=... Group: from Group: form Key=salt Group=... Group: salt Group: last Key=earn Group=... Group: earn Group: near

GroupBy - Comparer, Mapped


This sample uses GroupBy to partition trimmed elements of an array using a custom comparer that matches words that are anagrams of each other, and then converts the results to uppercase. public void Linq45() { string[] anagrams = {"from ", " salt", " earn ", " last ", " near ", " form "}; var orderGroups = anagrams.GroupBy( w => w.Trim(), a => a.ToUpper(), new AnagramEqualityComparer() ); ObjectDumper.Write(orderGroups, 1); } public class AnagramEqualityComparer : IEqualityComparer<string> { public bool Equals(string x, string y) { return getCanonicalString(x) == getCanonicalString(y); } public int GetHashCode(string obj) {

return getCanonicalString(obj).GetHashCode(); } private string getCanonicalString(string word) { char[] wordChars = word.ToCharArray(); Array.Sort<char>(wordChars); return new string(wordChars); } } Result ... FROM FORM ... SALT LAST ... EARN NEAR

Distinct - 1

This sample prints the prime factors of the number 300. The sample creates a sequence of unique factors by using the Distinct method on the integer array of factors to remove duplicates.

WriteLine(f); } }
Result Prime factors of 300: 2 3 5

Distinct - 2

This sample prints the unique Category names by first selecting all of the category names from the product list, then using Distinct to remove duplicate names.

ect p.Category) .Distinct();

riteLine(n); }

Result Category names: Beverages Condiments Produce Meat/Poultry Seafood Dairy Products Confections Grains/Cereals

Union - 1

This sample prints the unique elements of two integer arrays. The sample uses the Union method to create a sequence that is a union of the two integer arrays with duplicate elements removed.

sB);

th arrays:");

Result Unique numbers from both arrays: 0 2 4 5 6 8

9 1 3 7

Union - 2

This sample prints unique letters from Product and Customer names. The sample creates a sequence of product first characters, a sequence of customer first characters, then joins the two sets by using Union to merge them and remove duplicates.

tomers = GetCustomerList();

Union(customerFirstChars);

rom Product names and Customer names:");

Result Unique first letters from Product names and Customer names: C A G U N

M I Q K T P S R B J Z V F E W L O D H

Intersect - 1

This sample prints a list of numbers that are common to two integer arrays. The sample uses Intersect to create one sequence that contains the common values shared by both arrays.

mbersB);

by both arrays:");

Result Common numbers shared by both arrays:

5 8

Intersect - 2

This sample prints the letters that are both the first letter of a Product name and the first letter of a Customer name. The sample uses query statements to create two sequence - the first letters of Product names and the first letter of Customer names, then uses Intersect to create a sequence of letters common to both.

tomers = GetCustomerList();

Intersect(customerFirstChars);

rom Product names and Customer names:");

Result Common first letters from Product names and Customer names: C A G N M I Q

K T P S R B V F E W L O

Except - 1
This sample prints numbers that are in one integer array, but not another. The sample uses Except to create a sequence that contains the values from numbersA that are not also in numbersB. public void Linq52() { int[] numbersA = { 0, 2, 4, 5, 6, 8, 9 }; int[] numbersB = { 1, 3, 5, 7, 8 }; IEnumerable<int> aOnlyNumbers = numbersA.Except(numbersB); Console.WriteLine("Numbers in first array but not second array:"); foreach (var n in aOnlyNumbers) { Console.WriteLine(n); } } Result Numbers in first array but not second array: 0 2 4 6 9

Except - 2
This sample prints the first character of product names that aren't also the first character of customer names. After getting the first characters of product and customer names using query expressions, the sample uses Except to create a sequence of product characters that doesn't include first characters of customer names. public void Linq53() { List products = GetProductList(); List customers = GetCustomerList(); var productFirstChars =

from p in products select p.ProductName[0]; var customerFirstChars = from c in customers select c.CompanyName[0]; var productOnlyFirstChars = productFirstChars.Except(customerFirstChars); Console.WriteLine("First letters from Product names, but not from Customer names:"); foreach (var ch in productOnlyFirstChars) { Console.WriteLine(ch); } } Result First letters from Product names, but not from Customer names: U J Z

To Array
This sample generates an array of double values by first using a query expression with orderby to create a sorted sequence of doubles, then ToArray to generate an array from the sequence. public void Linq54() { double[] doubles = { 1.7, 2.3, 1.9, 4.1, 2.9 }; var sortedDoubles = from d in doubles orderby d descending select d; var doublesArray = sortedDoubles.ToArray(); Console.WriteLine("Every other double from highest to lowest:"); for (int d = 0; d < doublesArray.Length; d += 2) { Console.WriteLine(doublesArray[d]); } }

Result Every other double from highest to lowest: 4.1 2.3 1.7

To List

This sample generates an array of string values by first using a query expression with orderby to create a sorted sequence of strings from a string array, then toList to generate a List from the sequence. public void Linq55() { string[] words = { "cherry", "apple", "blueberry" }; var sortedWords = from w in words orderby w select w; var wordList = sortedWords.ToList(); Console.WriteLine("The sorted word list:"); foreach (var w in wordList) { Console.WriteLine(w); } } Result The sorted word list: apple blueberry cherry

To Dictionary
This sample uses anonymous types to create a data structure of people and their scores. It then uses ToDictionary to generate a dictionary from the sequence and its key expression. public void Linq56() { var scoreRecords = new [] { new {Name = "Alice", Score = 50}, new {Name = "Bob" , Score = 40}, new {Name = "Cathy", Score = 45} }; var scoreRecordsDict = scoreRecords.ToDictionary(sr => sr.Name); Console.WriteLine("Bob's score: {0}", scoreRecordsDict["Bob"]); } Result Bob's score: {Name=Bob, Score=40}

OfType
This sample prints all of the elements of an array that are of type double. The sample uses OfType to test the element's type. public void Linq57() { object[] numbers = { null, 1.0, "two", 3, 4.0f, 5, "six", 7.0 }; var doubles = numbers.OfType<double>();

Console.WriteLine("Numbers stored as doubles:"); foreach (var d in doubles) { Console.WriteLine(d); } } Result Numbers stored as doubles: 1 7

First - Simple
This sample uses First to return the first matching element as a Product, instead of as a sequence containing a Product. public void Linq58() { List products = GetProductList(); Product product12 = ( from p in products where p.ProductID == 12 select p ) .First(); ObjectDumper.Write(product12); } Result ProductID=12 ProductName=Queso Manchego La Pastora Category=Dairy Products UnitPrice=38.0000 UnitsInStock=86

First - Indexed
This sample prints the elements of an integer array that are both even and at an even index within the array. It uses First with an index parameter to find the desired numbers. public void Linq60() { int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; int evenNum = numbers.First((num, index) => (num % 2 == 0) && (index % 2 == 0)); Console.WriteLine("{0} is an even number at an even position within the list.", evenNum); } Result 6 is an even number at an even position within the list.

FirstOrDefault - Simple
This sample uses FirstOrDefault to try to return the first element of the sequence, unless there are no elements, in which case the default value for that type is returned. public void Linq61() { int[] numbers = {}; int firstNumOrDefault = numbers.FirstOrDefault(); Console.WriteLine(firstNumOrDefault); } Result 0

FirstOrDefault - Condition
This sample uses FirstOrDefault to return the first product whose ProductID is 789 as a single Product object, unless there is no match, in which case null is returned. public void Linq62() { List products = GetProductList(); Product product789 = products.FirstOrDefault(p => p.ProductID == 789); Console.WriteLine("Product 789 exists: {0}", product789 != null); } Result Product 789 exists: False

FirstOrDefault - Indexed
This sample uses FirstOrDefault to find a number in the array that is within 0.5 of its position in the array, and returns either the first match or the default value of double?, which is null. public void Linq63() { double?[] doubles = { 1.7, 2.3, 4.1, 1.9, 2.9 }; double? num = doubles.FirstOrDefault((n, index) => (n >= index - 0.5 && n <= index + 0.5)); if (num != null) Console.WriteLine("The value {1} is within 0.5 of its index position.", num); else Console.WriteLine("There is no number within 0.5 of its index position.", num); } Result

There is no number within 0.5 of its index position.

ElementAt
This sample prints the fourth number less that 5 in an integer array. The sample first uses a query expression then uses ElementAt to retrieve the fourth number from this sequence. Since ElementAt uses 0-based indexing, 3 is passed to the method to retrieve the fourth element. public void Linq64() { int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; int fourthLowNum = ( from n in numbers where n < 5 select n ) .ElementAt(3); // 3 because sequences use 0-based indexing Console.WriteLine("Fourth number < 5: {0}", fourthLowNum); } Result Fourth number < 5: 2

Range
This sample prints numbers in the range 100 to 149 and whether the number is odd or even. In the from clause, the sample uses Sequence.Range to create a sequence of 50 numbers starting at 100. It then uses the select clause to create an anonymous type consisting of the number and a string value indicating whether the number is odd or even. publicvoid Linq65() { var numbers = from n in Sequence.Range(100, 50) selectnew {Number = n, OddEven = n % 2 == 1 ? "odd" : "even"}; foreach (var n in numbers) { Console.WriteLine("The number {0} is {1}.", n.Number, n.OddEven); } } Result The number 100 is even. The number 101 is odd. The number 102 is even. The number 103 is odd. The number 104 is even. The number 105 is odd. The number 106 is even. The number 107 is odd. The number 108 is even.

The number 109 is odd. The number 110 is even. The number 111 is odd. The number 112 is even. The number 113 is odd. The number 114 is even. The number 115 is odd. The number 116 is even. The number 117 is odd. The number 118 is even. The number 119 is odd. The number 120 is even. The number 121 is odd. The number 122 is even. The number 123 is odd. The number 124 is even. The number 125 is odd. The number 126 is even. The number 127 is odd. The number 128 is even. The number 129 is odd. The number 130 is even. The number 131 is odd. The number 132 is even. The number 133 is odd. The number 134 is even. The number 135 is odd. The number 136 is even. The number 137 is odd. The number 138 is even. The number 139 is odd. The number 140 is even. The number 141 is odd. The number 142 is even. The number 143 is odd. The number 144 is even. The number 145 is odd. The number 146 is even. The number 147 is odd. The number 148 is even. The number 149 is odd.

Repeat

This sample uses Repeat to generate a sequence that contains the number 7 ten times.

publicvoid Linq66() { var numbers = Sequence.Repeat(7, 10); foreach (var n in numbers) { Console.WriteLine(n); } } Result 7 7 7 7 7 7 7 7 7 7

Any - Simple

This sample determines whether any words in a string array contain the character sequence 'ei'. It uses Any, passing a lambda expression that uses the Contains method to perform the check. public void Linq67() { string[] words = { "believe", "relief", "receipt", "field" }; bool iAfterE = words.Any(w => w.Contains("ei")); Console.WriteLine("There is a word that contains in the list that contains 'ei': {0}", iAfterE); } Result There is a word that contains in the list that contains 'ei': True

Any - Indexed

This sample determines whether any numbers in an integer array are the negative of their position in the array. The sample uses Any, passing a lambda expression to perform the test. public void Linq68() { int[] numbers = { -9, -4, -8, -3, -5, -2, -1, -6, -7 }; bool negativeMatch = numbers.Any((n, index) => n == -index); Console.WriteLine("There is a number that is the negative of its index: {0}", negativeMatch); }

Result There is a number that is the negative of its index: True

Any - Grouped

This sample prints all of the products in categories where at least one of the products in that category is out of stock. The sample first uses group by to group the products into categories. It then uses Any to find those groups that have any of the products out of stock. Finally, the select clause creates elements of the return sequence consisting of the Category as the key and the associated group of products. public void Linq69() { List products = GetProductList(); var productGroups = from p in products group p by p.Category into g where g.Group.Any(p => p.UnitsInStock == 0) select new {Category = g.Key, Products = g.Group}; ObjectDumper.Write(productGroups, 1); } Result Category=Condiments Products=... Products: ProductID=3 ProductName=Aniseed Syrup Category=Condiments UnitPrice=10.0000 UnitsInStock=13 Products: ProductID=4 ProductName=Chef Anton's Cajun Seasoning Category=Condiments UnitPrice=22.0000 UnitsInStock=53 Products: ProductID=5 ProductName=Chef Anton's Gumbo Mix Category=Condiments UnitPrice=21.3500 UnitsInStock=0 Products: ProductID=6 ProductName=Grandma's Boysenberry Spread Category=Condiments UnitPrice=25.0000 UnitsInStock=120 Products: ProductID=8 ProductName=Northwoods Cranberry Sauce Category=Condiments UnitPrice=40.0000 UnitsInStock=6 Products: ProductID=15 ProductName=Genen Shouyu Category=Condiments UnitPrice=15.5000 UnitsInStock=39 Products: ProductID=44 ProductName=Gula Malacca Category=Condiments UnitPrice=19.4500 UnitsInStock=27 Products: ProductID=61 ProductName=Sirop d'rable Category=Condiments UnitPrice=28.5000 UnitsInStock=113 Products: ProductID=63 ProductName=Vegie-spread Category=Condiments UnitPrice=43.9000 UnitsInStock=24 Products: ProductID=65 ProductName=Louisiana Fiery Hot Pepper Sauce Category=Condiments UnitPrice=21.0500 UnitsInStock=76 Products: ProductID=66 ProductName=Louisiana Hot Spiced Okra Category=Condiments UnitPrice=17.0000 UnitsInStock=4 Products: ProductID=77 ProductName=Original Frankfurter grne Soe Category=Condiments UnitPrice=13.0000 UnitsInStock=32 Category=Meat/Poultry Products=... Products: ProductID=9 ProductName=Mishi Kobe Niku Category=Meat/Poultry UnitPrice=97.0000 UnitsInStock=29 Products: ProductID=17 ProductName=Alice Mutton Category=Meat/Poultry UnitPrice=39.0000 UnitsInStock=0 Products: ProductID=29 ProductName=Thringer Rostbratwurst Category=Meat/Poultry UnitPrice=123.7900 UnitsInStock=0

Products: ProductID=53 ProductName=Perth Pasties Category=Meat/Poultry UnitPrice=32.8000 UnitsInStock=0 Products: ProductID=54 ProductName=Tourtire Category=Meat/Poultry UnitPrice=7.4500 UnitsInStock=21 Products: ProductID=55 ProductName=Pt chinois Category=Meat/Poultry UnitPrice=24.0000 UnitsInStock=115 Category=Dairy Products Products=... Products: ProductID=11 ProductName=Queso Cabrales Category=Dairy Products UnitPrice=21.0000 UnitsInStock=22 Products: ProductID=12 ProductName=Queso Manchego La Pastora Category=Dairy Products UnitPrice=38.0000 UnitsInStock=86 Products: ProductID=31 ProductName=Gorgonzola Telino Category=Dairy Products UnitPrice=12.5000 UnitsInStock=0 Products: ProductID=32 ProductName=Mascarpone Fabioli Category=Dairy Products UnitPrice=32.0000 UnitsInStock=9 Products: ProductID=33 ProductName=Geitost Category=Dairy Products UnitPrice=2.5000 UnitsInStock=112 Products: ProductID=59 ProductName=Raclette Courdavault Category=Dairy Products UnitPrice=55.0000 UnitsInStock=79 Products: ProductID=60 ProductName=Camembert Pierrot Category=Dairy Products UnitPrice=34.0000 UnitsInStock=19 Products: ProductID=69 ProductName=Gudbrandsdalsost Category=Dairy Products UnitPrice=36.0000 UnitsInStock=26 Products: ProductID=71 ProductName=Flotemysost Category=Dairy Products UnitPrice=21.5000 UnitsInStock=26 Products: ProductID=72 ProductName=Mozzarella di Giovanni Category=Dairy Products UnitPrice=34.8000 UnitsInStock=14

All - Simple

This sample uses All to determine whether an array contains only odd numbers. public void Linq70() { int[] numbers = { 1, 11, 3, 19, 41, 65, 19 }; bool onlyOdd = numbers.All(n => n % 2 == 1); Console.WriteLine("The list contains only odd numbers: {0}", onlyOdd); } Result The list contains only odd numbers: True

All - Indexed

This sample determines whether each element of an integer array is lower than its counterpart in another array. The sample uses an indexed All method, using the index to get the number in the other array to perform the comparison. public void Linq71() { int[] lowNumbers = { 1, 11, 3, 19, 41, 65, 19 }; int[] highNumbers = { 7, 19, 42, 22, 45, 79, 24 };

bool allLower = lowNumbers.All((num, index) => num < highNumbers[index]); Console.WriteLine("Each number in the first list is lower than its counterpart in the second list: {0}", allLower); } Result Each number in the first list is lower than its counterpart in the second list: True

All - Grouped

This sample prints all of the products in categories where none of the products in that category is out of stock. The sample first uses group by to group the products into categories. It then uses Any to find those groups that have no products out of stock. Finally, the select clause creates elements of the return sequence consisting of the Category as the key and the associated group of products. public void Linq72() { List products = GetProductList(); var productGroups = from p in products group p by p.Category into g where g.Group.All(p => p.UnitsInStock > 0) select new {Category = g.Key, Products = g.Group}; ObjectDumper.Write(productGroups, 1); } Result Category=Beverages Products=... Products: ProductID=1 ProductName=Chai Category=Beverages UnitPrice=18.0000 UnitsInStock=39 Products: ProductID=2 ProductName=Chang Category=Beverages UnitPrice=19.0000 UnitsInStock=17 Products: ProductID=24 ProductName=Guaran Fantstica Category=Beverages UnitPrice=4.5000 UnitsInStock=20 Products: ProductID=34 ProductName=Sasquatch Ale Category=Beverages UnitPrice=14.0000 UnitsInStock=111 Products: ProductID=35 ProductName=Steeleye Stout Category=Beverages UnitPrice=18.0000 UnitsInStock=20 Products: ProductID=38 ProductName=Cte de Blaye Category=Beverages UnitPrice=263.5000 UnitsInStock=17 Products: ProductID=39 ProductName=Chartreuse verte Category=Beverages UnitPrice=18.0000 UnitsInStock=69 Products: ProductID=43 ProductName=Ipoh Coffee Category=Beverages UnitPrice=46.0000 UnitsInStock=17 Products: ProductID=67 ProductName=Laughing Lumberjack Lager Category=Beverages UnitPrice=14.0000 UnitsInStock=52 Products: ProductID=70 ProductName=Outback Lager Category=Beverages UnitPrice=15.0000 UnitsInStock=15 Products: ProductID=75 ProductName=Rhnbru Klosterbier Category=Beverages UnitPrice=7.7500 UnitsInStock=125 Products: ProductID=76 ProductName=Lakkalikri Category=Beverages UnitPrice=18.0000 UnitsInStock=57 Category=Produce Products=... Products: ProductID=7 ProductName=Uncle Bob's Organic Dried Pears Category=Produce UnitPrice=30.0000 UnitsInStock=15 Products: ProductID=14 ProductName=Tofu Category=Produce UnitPrice=23.2500 UnitsInStock=35 Products: ProductID=28 ProductName=Rssle Sauerkraut Category=Produce UnitPrice=45.6000 UnitsInStock=26

Products: ProductID=51 ProductName=Manjimup Dried Apples Category=Produce UnitPrice=53.0000 UnitsInStock=20 Products: ProductID=74 ProductName=Longlife Tofu Category=Produce UnitPrice=10.0000 UnitsInStock=4 Category=Seafood Products=... Products: ProductID=10 ProductName=Ikura Category=Seafood UnitPrice=31.0000 UnitsInStock=31 Products: ProductID=13 ProductName=Konbu Category=Seafood UnitPrice=6.0000 UnitsInStock=24 Products: ProductID=18 ProductName=Carnarvon Tigers Category=Seafood UnitPrice=62.5000 UnitsInStock=42 Products: ProductID=30 ProductName=Nord-Ost Matjeshering Category=Seafood UnitPrice=25.8900 UnitsInStock=10 Products: ProductID=36 ProductName=Inlagd Sill Category=Seafood UnitPrice=19.0000 UnitsInStock=112 Products: ProductID=37 ProductName=Gravad lax Category=Seafood UnitPrice=26.0000 UnitsInStock=11 Products: ProductID=40 ProductName=Boston Crab Meat Category=Seafood UnitPrice=18.4000 UnitsInStock=123 Products: ProductID=41 ProductName=Jack's New England Clam Chowder Category=Seafood UnitPrice=9.6500 UnitsInStock=85 Products: ProductID=45 ProductName=Rogede sild Category=Seafood UnitPrice=9.5000 UnitsInStock=5 Products: ProductID=46 ProductName=Spegesild Category=Seafood UnitPrice=12.0000 UnitsInStock=95 Products: ProductID=58 ProductName=Escargots de Bourgogne Category=Seafood UnitPrice=13.2500 UnitsInStock=62 Products: ProductID=73 ProductName=Rd Kaviar Category=Seafood UnitPrice=15.0000 UnitsInStock=101 Category=Confections Products=... Products: ProductID=16 ProductName=Pavlova Category=Confections UnitPrice=17.4500 UnitsInStock=29 Products: ProductID=19 ProductName=Teatime Chocolate Biscuits Category=Confections UnitPrice=9.2000 UnitsInStock=25 Products: ProductID=20 ProductName=Sir Rodney's Marmalade Category=Confections UnitPrice=81.0000 UnitsInStock=40 Products: ProductID=21 ProductName=Sir Rodney's Scones Category=Confections UnitPrice=10.0000 UnitsInStock=3 Products: ProductID=25 ProductName=NuNuCa Nu-Nougat-Creme Category=Confections UnitPrice=14.0000 UnitsInStock=76 Products: ProductID=26 ProductName=Gumbr Gummibrchen Category=Confections UnitPrice=31.2300 UnitsInStock=15 Products: ProductID=27 ProductName=Schoggi Schokolade Category=Confections UnitPrice=43.9000 UnitsInStock=49 Products: ProductID=47 ProductName=Zaanse koeken Category=Confections UnitPrice=9.5000 UnitsInStock=36 Products: ProductID=48 ProductName=Chocolade Category=Confections UnitPrice=12.7500 UnitsInStock=15 Products: ProductID=49 ProductName=Maxilaku Category=Confections UnitPrice=20.0000 UnitsInStock=10 Products: ProductID=50 ProductName=Valkoinen suklaa Category=Confections UnitPrice=16.2500 UnitsInStock=65 Products: ProductID=62 ProductName=Tarte au sucre Category=Confections UnitPrice=49.3000 UnitsInStock=17 Products: ProductID=68 ProductName=Scottish Longbreads Category=Confections UnitPrice=12.5000 UnitsInStock=6 Category=Grains/Cereals Products=... Products: ProductID=22 ProductName=Gustaf's Knckebrd Category=Grains/Cereals UnitPrice=21.0000 UnitsInStock=104 Products: ProductID=23 ProductName=Tunnbrd Category=Grains/Cereals UnitPrice=9.0000 UnitsInStock=61 Products: ProductID=42 ProductName=Singaporean Hokkien Fried Mee Category=Grains/Cereals UnitPrice=14.0000 UnitsInStock=26

Products: ProductID=52 ProductName=Filo Mix Category=Grains/Cereals UnitPrice=7.0000 UnitsInStock=38 Products: ProductID=56 ProductName=Gnocchi di nonna Alice Category=Grains/Cereals UnitPrice=38.0000 UnitsInStock=21 Products: ProductID=57 ProductName=Ravioli Angelo Category=Grains/Cereals UnitPrice=19.5000 UnitsInStock=36 Products: ProductID=64 ProductName=Wimmers gute Semmelkndel Category=Grains/Cereals UnitPrice=33.2500 UnitsInStock=22

Count - Simple

This determines the number of unique factors of the number 300. The sample starts with the input integer array, uses Distinct to create a sequence with duplicate elements removed, then uses Count on this sequence to determine the number of unique factors. public void Linq73() { int[] factorsOf300 = { 2, 2, 3, 5, 5 }; int uniqueFactors = factorsOf300.Distinct().Count(); Console.WriteLine("There are {0} unique factors of 300.", uniqueFactors); } Result There are 3 unique factors of 300.

Count - Conditional

This sample finds the number of odd elements of an integer array. The sample passes a lambda expression to Count that it uses to perform the test, while Count handles the iteration and maintains the running total. public void Linq74() { int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; int oddNumbers = numbers.Count(n => n % 2 == 1); Console.WriteLine("There are {0} odd numbers in the list.", oddNumbers); } Result There are 5 odd numbers in the list.

Count - Indexed
This sample uses Count to get the number of ints in the array whose value is odd if its position is odd, or whose value is even if its position is even. public void Linq75() { int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; int oddEvenMatches = numbers.Count((n, index) => n % 2 == index % 2);

Console.WriteLine("There are {0} numbers in the list whose odd/even status " + "matches that of their position.", oddEvenMatches); } Result There are 4 numbers in the list whose odd/even status matches that of their position.

Count - Nested

This sample uses Count to return a list of customers and how many orders each has. public void Linq76() { List customers = GetCustomerList(); var orderCounts = from c in customers select new {c.CustomerID, OrderCount = c.Orders.Count()}; ObjectDumper.Write(orderCounts); } Result CustomerID=ALFKI OrderCount=6 CustomerID=ANATR OrderCount=4 CustomerID=ANTON OrderCount=7 CustomerID=AROUT OrderCount=13 CustomerID=BERGS OrderCount=18 CustomerID=BLAUS OrderCount=7 CustomerID=BLONP OrderCount=11 CustomerID=BOLID OrderCount=3 CustomerID=BONAP OrderCount=17 CustomerID=BOTTM OrderCount=14 CustomerID=BSBEV OrderCount=10 CustomerID=CACTU OrderCount=6 CustomerID=CENTC OrderCount=1 CustomerID=CHOPS OrderCount=8 CustomerID=COMMI OrderCount=5 CustomerID=CONSH OrderCount=3 CustomerID=DRACD OrderCount=6 CustomerID=DUMON OrderCount=4 CustomerID=EASTC OrderCount=8 CustomerID=ERNSH OrderCount=30 CustomerID=FAMIA OrderCount=7 CustomerID=FISSA OrderCount=0 CustomerID=FOLIG OrderCount=5 CustomerID=FOLKO OrderCount=19 CustomerID=FRANK OrderCount=15 CustomerID=FRANR OrderCount=3

CustomerID=FRANS OrderCount=6 CustomerID=FURIB OrderCount=8 CustomerID=GALED OrderCount=5 CustomerID=GODOS OrderCount=10 CustomerID=GOURL OrderCount=9 CustomerID=GREAL OrderCount=11 CustomerID=GROSR OrderCount=2 CustomerID=HANAR OrderCount=14 CustomerID=HILAA OrderCount=18 CustomerID=HUNGC OrderCount=5 CustomerID=HUNGO OrderCount=19 CustomerID=ISLAT OrderCount=10 CustomerID=KOENE OrderCount=14 CustomerID=LACOR OrderCount=4 CustomerID=LAMAI OrderCount=14 CustomerID=LAUGB OrderCount=3 CustomerID=LAZYK OrderCount=2 CustomerID=LEHMS OrderCount=15 CustomerID=LETSS OrderCount=4 CustomerID=LILAS OrderCount=14 CustomerID=LINOD OrderCount=12 CustomerID=LONEP OrderCount=8 CustomerID=MAGAA OrderCount=10 CustomerID=MAISD OrderCount=7 CustomerID=MEREP OrderCount=13 CustomerID=MORGK OrderCount=5 CustomerID=NORTS OrderCount=3 CustomerID=OCEAN OrderCount=5 CustomerID=OLDWO OrderCount=10 CustomerID=OTTIK OrderCount=9 CustomerID=PARIS OrderCount=0 CustomerID=PERIC OrderCount=6 CustomerID=PICCO OrderCount=10 CustomerID=PRINI OrderCount=6 CustomerID=QUEDE OrderCount=9 CustomerID=QUEEN OrderCount=13 CustomerID=QUICK OrderCount=28 CustomerID=RANCH OrderCount=5 CustomerID=RATTC OrderCount=18 CustomerID=REGGC OrderCount=12 CustomerID=RICAR OrderCount=11 CustomerID=RICSU OrderCount=10 CustomerID=ROMEY OrderCount=5 CustomerID=SANTG OrderCount=6 CustomerID=SAVEA OrderCount=31 CustomerID=SEVES OrderCount=9 CustomerID=SIMOB OrderCount=7

CustomerID=SPECD OrderCount=4 CustomerID=SPLIR OrderCount=9 CustomerID=SUPRD OrderCount=12 CustomerID=THEBI OrderCount=4 CustomerID=THECR OrderCount=3 CustomerID=TOMSP OrderCount=5 CustomerID=TORTU OrderCount=10 CustomerID=TRADH OrderCount=7 CustomerID=TRAIH OrderCount=3 CustomerID=VAFFE OrderCount=11 CustomerID=VICTE OrderCount=10 CustomerID=VINET OrderCount=4 CustomerID=WANDK OrderCount=10 CustomerID=WARTH OrderCount=15 CustomerID=WELLI OrderCount=9 CustomerID=WHITC OrderCount=14 CustomerID=WILMK OrderCount=8 CustomerID=WOLZA OrderCount=7

Count - Grouped

This sample prints each category and the number of products in that category. The sample first uses group by to group the products according to their categories. Then it uses select to create an anonymous for each category that contains the category and number of products. public void Linq77() { List products = GetProductList(); var categoryCounts = from p in products group p by p.Category into g select new {Category = g.Key, ProductCount = g.Group.Count()}; ObjectDumper.Write(categoryCounts); } Result Category=Beverages ProductCount=12 Category=Condiments ProductCount=12 Category=Produce ProductCount=5 Category=Meat/Poultry ProductCount=6 Category=Seafood ProductCount=12 Category=Dairy Products ProductCount=10 Category=Confections ProductCount=13 Category=Grains/Cereals ProductCount=7

Sum - Simple

This sample used Sum to find the total of all of the numbers in an integer array. public void Linq78() { int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; double numSum = numbers.Sum(); Console.WriteLine("The sum of the numbers is {0}.", numSum); } Result The sum of the numbers is 45.

Sum - Projection

This sample uses Sum to find the total number of characters in all of the words in a string array. public void Linq79() { string[] words = { "cherry", "apple", "blueberry" }; double totalChars = words.Sum(w => w.Length); Console.WriteLine("There are a total of {0} characters in these words.", totalChars); } Result There are a total of 20 characters in these words.

Sum - Grouped

This sample prints, for each category, the total number of units in stock for all products in that category. The sample first uses group by to group the products into categories. It then uses Sum on each group to add the number of units in stock for all products. public static void Linq80() { List<Product> products = GetProductList(); var categories = from p in products group p by p.Category into g select new { Category = g.Key, TotalUnitsInStock = g.Sum(p => p.UnitsInStock) }; ObjectDumper.Write(categories); } Result Category=Beverages TotalUnitsInStock=559 Category=Condiments TotalUnitsInStock=507 Category=Produce TotalUnitsInStock=100

Category=Meat/Poultry TotalUnitsInStock=165 Category=Seafood TotalUnitsInStock=701 Category=Dairy Products TotalUnitsInStock=393 Category=Confections TotalUnitsInStock=386 Category=Grains/Cereals TotalUnitsInStock=308

Min - Simple

This sample uses Min to get the lowest number in an integer array. public void Linq81() { int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; int minNum = numbers.Min(); Console.WriteLine("The minimum number is {0}.", minNum); } Result The minimum number is 0.

Min - Projection

This sample uses Min to get the length of the shortest word in a string array. public void Linq82() { string[] words = { "cherry", "apple", "blueberry" }; int shortestWord = words.Min(w => w.Length); Console.WriteLine("The shortest word is {0} characters long.", shortestWord); } Result The shortest word is 5 characters long.

Min - Grouped

This sample finds, for each category, the lowest of all product prices. The sample uses group by to group the products into categories and select to create a sequence of anonymous objects that contain the Category and the minimum price. The minimum price for each group is found using Min, comparing the UnitPrice for each product. public void Linq83() { List products = GetProductList(); var categories = from p in products group p by p.Category into g

select new {Category = g.Key, CheapestPrice = g.Group.Min(p => p.UnitPrice)}; ObjectDumper.Write(categories); } Result Category=Beverages CheapestPrice=4.5000 Category=Condiments CheapestPrice=10.0000 Category=Produce CheapestPrice=10.0000 Category=Meat/Poultry CheapestPrice=7.4500 Category=Seafood CheapestPrice=6.0000 Category=Dairy Products CheapestPrice=2.5000 Category=Confections CheapestPrice=9.2000 Category=Grains/Cereals CheapestPrice=7.0000

Min - Elements

This sample finds the cheapest products in each category. It first groups the products into categories using group by. Then, for each group of products in a category, it finds the lowest price using Min and then finds all products in the category with the same lowest price. public void Linq84() { List products = GetProductList(); var categories = from p in products group p by p.Category into g from minPrice = g.Group.Min(p => p.UnitPrice) select new {Category = g.Key, CheapestProducts = g.Group.Where(p => p.UnitPrice == minPrice)}; ObjectDumper.Write(categories, 1); } Result Category=Beverages CheapestProducts=... CheapestProducts: ProductID=24 ProductName=Guaran Fantstica Category=Beverages UnitPrice=4.5000 UnitsInStock=20 Category=Condiments CheapestProducts=... CheapestProducts: ProductID=3 ProductName=Aniseed Syrup Category=Condiments UnitPrice=10.0000 UnitsInStock=13 Category=Produce CheapestProducts=... CheapestProducts: ProductID=74 ProductName=Longlife Tofu Category=Produce UnitPrice=10.0000 UnitsInStock=4 Category=Meat/Poultry CheapestProducts=... CheapestProducts: ProductID=54 ProductName=Tourtire Category=Meat/Poultry UnitPrice=7.4500 UnitsInStock=21 Category=Seafood CheapestProducts=... CheapestProducts: ProductID=13 ProductName=Konbu Category=Seafood UnitPrice=6.0000 UnitsInStock=24 Category=Dairy Products CheapestProducts=...

CheapestProducts: ProductID=33 ProductName=Geitost Category=Dairy Products UnitPrice=2.5000 UnitsInStock=112 Category=Confections CheapestProducts=... CheapestProducts: ProductID=19 ProductName=Teatime Chocolate Biscuits Category=Confections UnitPrice=9.2000 UnitsInStock=25 Category=Grains/Cereals CheapestProducts=... CheapestProducts: ProductID=52 ProductName=Filo Mix Category=Grains/Cereals UnitPrice=7.0000 UnitsInStock=38

Max - Simple

This sample uses Max to get the highest number in an integer array. public void Linq85() { int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; int maxNum = numbers.Max(); Console.WriteLine("The maximum number is {0}.", maxNum); } Result The maximum number is 9.

Max - Projection

This sample uses Max to get the length of the longest word in a string array. public void Linq86() { string[] words = { "cherry", "apple", "blueberry" }; int longestLength = words.Max(w => w.Length); Console.WriteLine("The longest word is {0} characters long.", longestLength); } Result The longest word is 9 characters long.

Max - Grouped

This sample finds the most expensive price in each category. The sample uses group by to group the products into categories. Then it finds the minimum price for each group using Max, comparing the UnitPrice for each product. public void Linq87() { List products = GetProductList(); var categories =

from p in products group p by p.Category into g select new {Category = g.Key, MostExpensivePrice = g.Group.Max(p => p.UnitPrice)}; ObjectDumper.Write(categories); } Result Category=Beverages MostExpensivePrice=263.5000 Category=Condiments MostExpensivePrice=43.9000 Category=Produce MostExpensivePrice=53.0000 Category=Meat/Poultry MostExpensivePrice=123.7900 Category=Seafood MostExpensivePrice=62.5000 Category=Dairy Products MostExpensivePrice=55.0000 Category=Confections MostExpensivePrice=81.0000 Category=Grains/Cereals MostExpensivePrice=38.0000

Max - Elements

This sample finds the most expensive products in each category. The sample uses group by to group the products into categories. Then it finds the minimum price for each group using Max, comparing the UnitPrice for each product. Finally, the sample uses Where to find other products in the group with the same maximum price. public void Linq88() { List<Product> products = GetProductList(); var categories = from p in products group p by p.Category into g let maxPrice = g.Max(p => p.UnitPrice) select new {Category = g.Key, MostExpensiveProducts = g.Where(p => p.UnitPrice == maxPrice)}; ObjectDumper.Write(categories, 1); } Result Category=Beverages MostExpensiveProducts=... MostExpensiveProducts: ProductID=38 ProductName=Cte de Blaye Category=Beverages UnitPrice=263.5000 UnitsInStock=17 Category=Condiments MostExpensiveProducts=... MostExpensiveProducts: ProductID=63 ProductName=Vegie-spread Category=Condiments UnitPrice=43.9000 UnitsInStock=24 Category=Produce MostExpensiveProducts=... MostExpensiveProducts: ProductID=51 ProductName=Manjimup Dried Apples Category=Produce UnitPrice=53.0000 UnitsInStock=20 Category=Meat/Poultry MostExpensiveProducts=... MostExpensiveProducts: ProductID=29 ProductName=Thringer Rostbratwurst Category=Meat/Poultry UnitPrice=123.7900 UnitsInStock=0

Category=Seafood MostExpensiveProducts=... MostExpensiveProducts: ProductID=18 ProductName=Carnarvon Tigers Category=Seafood UnitPrice=62.5000 UnitsInStock=42 Category=Dairy Products MostExpensiveProducts=... MostExpensiveProducts: ProductID=59 ProductName=Raclette Courdavault Category=Dairy Products UnitPrice=55.0000 UnitsInStock=79 Category=Confections MostExpensiveProducts=... MostExpensiveProducts: ProductID=20 ProductName=Sir Rodney's Marmalade Category=Confections UnitPrice=81.0000 UnitsInStock=40 Category=Grains/Cereals MostExpensiveProducts=... MostExpensiveProducts: ProductID=56 ProductName=Gnocchi di nonna Alice Category=Grains/Cereals UnitPrice=38.0000 UnitsInStock=21

Average - Simple

This sample uses Average to get the average of all values of an integer array. public void Linq89() { int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; double averageNum = numbers.Average(); Console.WriteLine("The average number is {0}.", averageNum); } Result The average number is 4.5.

Average - Projection

This sample uses Average to get the average length of the words in the string array. public void Linq90() { string[] words = { "cherry", "apple", "blueberry" }; double averageLength = words.Average(w => w.Length); Console.WriteLine("The average word length is {0} characters.", averageLength); } Result The average word length is 6.66666666666667 characters.

Average - Grouped

This sample prints the average price of the products in each category. The sample first groups products into categories using group by. Then, for each group, it uses Average to average the UnitPrice values. The select clause creates the resulting sequence of categories and average values.

public void Linq91() { List products = GetProductList(); var categories = from p in products group p by p.Category into g select new {Category = g.Key, AveragePrice = g.Group.Average(p => p.UnitPrice)}; ObjectDumper.Write(categories); } Result Category=Beverages AveragePrice=37.979166666666666666666666667 Category=Condiments AveragePrice=23.0625 Category=Produce AveragePrice=32.3700 Category=Meat/Poultry AveragePrice=54.006666666666666666666666667 Category=Seafood AveragePrice=20.6825 Category=Dairy Products AveragePrice=28.7300 Category=Confections AveragePrice=25.1600 Category=Grains/Cereals AveragePrice=20.2500

Aggregate - Simple

This sample finds the product of all elements of an array of doubles. The samples uses Aggregate to create a running product on the array, passing each element in turn to the lambda expression that performs the multiplication. public void Linq92() { double[] doubles = { 1.7, 2.3, 1.9, 4.1, 2.9 }; double product = doubles.Aggregate((runningProduct, nextFactor) => runningProduct * nextFactor); Console.WriteLine("Total product of all numbers: {0}", product); } Result Total product of all numbers: 88.33081

Aggregate - Seed

This sample subtracts a sequence of integers from a starting value, simulating withdrawls from an account. While there is still cash left in the account, the withdrawal succeeds. The sample uses Aggregate to pass each withdrawal value in turn to the lambda expression that performs the subtraction. public void Linq93() { double startBalance = 100.0; int[] attemptedWithdrawals = { 20, 10, 40, 50, 10, 70, 30 };

double endBalance = attemptedWithdrawals.Aggregate(startBalance, (balance, nextWithdrawal) => ( (nextWithdrawal <= balance) ? (balance - nextWithdrawal) : balance ) ); Console.WriteLine("Ending balance: {0}", endBalance); } Result Ending balance: 20

Concat - 1
This sample merges two integer arrays into a single sequence. The sample uses Concat to create the sequence with each array's values, one after the other. public void Linq94() { int[] numbersA = { 0, 2, 4, 5, 6, 8, 9 }; int[] numbersB = { 1, 3, 5, 7, 8 }; var allNumbers = numbersA.Concat(numbersB); Console.WriteLine("All numbers from both arrays:"); foreach (var n in allNumbers) { Console.WriteLine(n); } } Result All numbers from both arrays: 0 2 4 5 6 8 9 1 3 5 7 8

Concat - 2
This sample prints all customer names followed by all product names. The sample uses Concat to create one sequence that contains the names of all customers and products, then uses foreach to iterate over the new sequence and print out the names. public void Linq95() { List customers = GetCustomerList(); List products = GetProductList();

var customerNames = from c in customers select c.CompanyName; var productNames = from p in products select p.ProductName; var allNames = customerNames.Concat(productNames); Console.WriteLine("Customer and product names:"); foreach (var n in allNames) { Console.WriteLine(n); } } Result Customer and product names: Alfreds Futterkiste Ana Trujillo Emparedados y helados Antonio Moreno Taquera Around the Horn Berglunds snabbkp Blauer See Delikatessen Blondel pre et fils Blido Comidas preparadas Bon app' Bottom-Dollar Markets B's Beverages Cactus Comidas para llevar Centro comercial Moctezuma Chop-suey Chinese Comrcio Mineiro Consolidated Holdings Drachenblut Delikatessen Du monde entier Eastern Connection Ernst Handel Familia Arquibaldo FISSA Fabrica Inter. Salchichas S.A. Folies gourmandes Folk och f HB Frankenversand France restauration Franchi S.p.A. Furia Bacalhau e Frutos do Mar Galera del gastrnomo Godos Cocina Tpica

Gourmet Lanchonetes Great Lakes Food Market GROSELLA-Restaurante Hanari Carnes HILARIN-Abastos Hungry Coyote Import Store Hungry Owl All-Night Grocers Island Trading Kniglich Essen La corne d'abondance La maison d'Asie Laughing Bacchus Wine Cellars Lazy K Kountry Store Lehmanns Marktstand Let's Stop N Shop LILA-Supermercado LINO-Delicateses Lonesome Pine Restaurant Magazzini Alimentari Riuniti Maison Dewey Mre Paillarde Morgenstern Gesundkost North/South Ocano Atlntico Ltda. Old World Delicatessen Ottilies Kseladen Paris spcialits Pericles Comidas clsicas Piccolo und mehr Princesa Isabel Vinhos Que Delcia Queen Cozinha QUICK-Stop Rancho grande Rattlesnake Canyon Grocery Reggiani Caseifici Ricardo Adocicados Richter Supermarkt Romero y tomillo Sant Gourmet Save-a-lot Markets Seven Seas Imports Simons bistro Spcialits du monde Split Rail Beer & Ale Suprecirc;mes dlices The Big Cheese

The Cracker Box Toms Spezialitten Tortuga Restaurante Tradiao Hipermercados Trail's Head Gourmet Provisioners Vaffeljernet Victuailles en stock Vins et alcools Chevalier Die Wandernde Kuh Wartian Herkku Wellington Importadora White Clover Markets Wilman Kala Wolski Zajazd Chai Chang Aniseed Syrup Chef Anton's Cajun Seasoning Chef Anton's Gumbo Mix Grandma's Boysenberry Spread Uncle Bob's Organic Dried Pears Northwoods Cranberry Sauce Mishi Kobe Niku Ikura Queso Cabrales Queso Manchego La Pastora Konbu Tofu Genen Shouyu Pavlova Alice Mutton Carnarvon Tigers Teatime Chocolate Biscuits Sir Rodney's Marmalade Sir Rodney's Scones Gustaf's Knckebrd Tunnbrd Guaran Fantstica NuNuCa Nu-Nougat-Creme Gumbr Gummibrchen Schoggi Schokolade Rssle Sauerkraut Thringer Rostbratwurst Nord-Ost Matjeshering Gorgonzola Telino Mascarpone Fabioli Geitost

Sasquatch Ale Steeleye Stout Inlagd Sill Gravad lax Cte de Blaye Chartreuse verte Boston Crab Meat Jack's New England Clam Chowder Singaporean Hokkien Fried Mee Ipoh Coffee Gula Malacca Rogede sild Spegesild Zaanse koeken Chocolade Maxilaku Valkoinen suklaa Manjimup Dried Apples Filo Mix Perth Pasties Tourtire Pt chinois Gnocchi di nonna Alice Ravioli Angelo Escargots de Bourgogne Raclette Courdavault Camembert Pierrot Sirop d'rable Tarte au sucre Vegie-spread Wimmers gute Semmelkndel Louisiana Fiery Hot Pepper Sauce Louisiana Hot Spiced Okra Laughing Lumberjack Lager Scottish Longbreads Gudbrandsdalsost Outback Lager Flotemysost Mozzarella di Giovanni Rd Kaviar Longlife Tofu Rhnbru Klosterbier Lakkalikri Original Frankfurter grne Soe

EqualAll - 1

This sample determines if two string arrays have the same elements in the same order. It uses EqualAll to compare the two arrays, element by element. public void Linq96() { var wordsA = new string[] { "cherry", "apple", "blueberry" }; var wordsB = new string[] { "cherry", "apple", "blueberry" }; bool match = wordsA.EqualAll(wordsB); Console.WriteLine("The sequences match: {0}", match); } Result The sequences match: True

EqualAll - 2
This sample determines if two string arrays have the same elements in the same order. It uses EqualAll to compare the two arrays, element by element. public void Linq97() { var wordsA = new string[] { "cherry", "apple", "blueberry" }; var wordsB = new string[] { "apple", "blueberry", "cherry" }; bool match = wordsA.EqualAll(wordsB); Console.WriteLine("The sequences match: {0}", match); } Result The sequences match: False

Combine
This sample calculates the dot product of two integer vectors. It uses a user-created sequence operator, Combine, to calculate the dot product, passing it a lambda function to multiply two arrays, element by element, and sum the result. public static class CustomSequenceOperators { public static IEnumerable Combine(this IEnumerable first, IEnumerable second, Func func) { using (IEnumerator e1 = first.GetEnumerator(), e2 = second.GetEnumerator()) { while (e1.MoveNext() && e2.MoveNext()) { yield return func(e1.Current, e2.Current); } } } } public void Linq98() {

int[] vectorA = { 0, 2, 4, 5, 6 }; int[] vectorB = { 1, 3, 5, 7, 8 }; int dotProduct = vectorA.Combine(vectorB, (a, b) => a * b).Sum(); Console.WriteLine("Dot product: {0}", dotProduct); } Result Dot product: 109

Deferred
This sample shows how query execution is deferred until the query is enumerated at a foreach statement. Sequence operators form first-class queries that are not executed until you enumerate them. public void Linq99() { // Sequence operators form first-class queries that // are not executed until you enumerate over them. int[] numbers = new int[] { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; int i = 0; var q = from n in numbers select ++i; // Note, the local variable 'i' is not incremented // until each element is evaluated (as a side-effect): foreach (var v in q) { Console.WriteLine("v = {0}, i = {1}", v, i); } } Result v = 1, i = 1 v = 2, i = 2 v = 3, i = 3 v = 4, i = 4 v = 5, i = 5 v = 6, i = 6 v = 7, i = 7 v = 8, i = 8 v = 9, i = 9 v = 10, i = 10

Immediate
This sample shows how queries can be executed immediately with operators such as ToList(). Methods like ToList() cause the query to be executed immediately, caching the results.

public void Linq100() { // Methods like ToList() cause the query to be // executed immediately, caching the results. int[] numbers = new int[] { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; int i = 0; var q = ( from n in numbers select ++i ) .ToList(); // The local variable i has already been fully // incremented before we iterate the results: foreach (var v in q) { Console.WriteLine("v = {0}, i = {1}", v, i); } } Result v = 1, i = 10 v = 2, i = 10 v = 3, i = 10 v = 4, i = 10 v = 5, i = 10 v = 6, i = 10 v = 7, i = 10 v = 8, i = 10 v = 9, i = 10 v = 10, i = 10

Query Reuse
This sample shows how, because of deferred execution, queries can be reused. Deferred execution lets you define a query once and reuse it, even after data changes. public void Linq101() { // Deferred execution lets us define a query once // and then reuse it later after data changes. int[] numbers = new int[] { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; var lowNumbers = from n in numbers where n <= 3 select n; Console.WriteLine("First run numbers <= 3:"); foreach (int n in lowNumbers) { Console.WriteLine(n);

} for (int i = 0; i < 10; i++) { numbers[i] = -numbers[i]; } // During this second run, the same query object, // lowNumbers, will be iterating over the new state // of numbers[], producing different results: Console.WriteLine("Second run numbers <= 3:"); foreach (int n in lowNumbers) { Console.WriteLine(n); } } Result First run numbers <= 3: 1 3 2 0 Second run numbers <= 3: -5 -4 -1 -3 -9 -8 -6 -7 -2 0 GetProductList() is a routine used by many of the samples. It is defined as: public List GetProductList() { productList = new List { { ProductID = 1, ProductName = "Chai", Category = "Beverages", UnitPrice = 18.0000M, UnitsInStock = 39 }, { ProductID = 2, ProductName = "Chang", Category = "Beverages", UnitPrice = 19.0000M, UnitsInStock = 17 }, { ProductID = 3, ProductName = "Aniseed Syrup", Category = "Condiments", UnitPrice = 10.0000M, UnitsInStock = 13 }, { ProductID = 4, ProductName = "Chef Anton's Cajun Seasoning", Category = "Condiments", UnitPrice = 22.0000M, UnitsInStock = 53 }, { ProductID = 5, ProductName = "Chef Anton's Gumbo Mix", Category = "Condiments", UnitPrice = 21.3500M, UnitsInStock = 0 }, { ProductID = 6, ProductName = "Grandma's Boysenberry Spread", Category = "Condiments", UnitPrice = 25.0000M, UnitsInStock = 120 }, { ProductID = 7, ProductName = "Uncle Bob's Organic Dried Pears", Category = "Produce", UnitPrice = 30.0000M, UnitsInStock = 15 }, { ProductID = 8, ProductName = "Northwoods Cranberry Sauce", Category = "Condiments", UnitPrice = 40.0000M, UnitsInStock = 6 }, { ProductID = 9, ProductName = "Mishi Kobe Niku", Category = "Meat/Poultry", UnitPrice = 97.0000M, UnitsInStock = 29 }, { ProductID = 10, ProductName = "Ikura", Category = "Seafood", UnitPrice = 31.0000M, UnitsInStock = 31 }, { ProductID = 11, ProductName = "Queso Cabrales", Category = "Dairy Products", UnitPrice = 21.0000M, UnitsInStock = 22 },

{ ProductID = 12, ProductName = "Queso Manchego La Pastora", Category = "Dairy Products", UnitPrice = 38.0000M, UnitsInStock = 86 }, { ProductID = 13, ProductName = "Konbu", Category = "Seafood", UnitPrice = 6.0000M, UnitsInStock = 24 }, { ProductID = 14, ProductName = "Tofu", Category = "Produce", UnitPrice = 23.2500M, UnitsInStock = 35 }, { ProductID = 15, ProductName = "Genen Shouyu", Category = "Condiments", UnitPrice = 15.5000M, UnitsInStock = 39 }, { ProductID = 16, ProductName = "Pavlova", Category = "Confections", UnitPrice = 17.4500M, UnitsInStock = 29 }, { ProductID = 17, ProductName = "Alice Mutton", Category = "Meat/Poultry", UnitPrice = 39.0000M, UnitsInStock = 0 }, { ProductID = 18, ProductName = "Carnarvon Tigers", Category = "Seafood", UnitPrice = 62.5000M, UnitsInStock = 42 }, { ProductID = 19, ProductName = "Teatime Chocolate Biscuits", Category = "Confections", UnitPrice = 9.2000M, UnitsInStock = 25 }, { ProductID = 20, ProductName = "Sir Rodney's Marmalade", Category = "Confections", UnitPrice = 81.0000M, UnitsInStock = 40 }, { ProductID = 21, ProductName = "Sir Rodney's Scones", Category = "Confections", UnitPrice = 10.0000M, UnitsInStock = 3 }, { ProductID = 22, ProductName = "Gustaf's Knckebrd", Category = "Grains/Cereals", UnitPrice = 21.0000M, UnitsInStock = 104 }, { ProductID = 23, ProductName = "Tunnbrd", Category = "Grains/Cereals", UnitPrice = 9.0000M, UnitsInStock = 61 }, { ProductID = 24, ProductName = "Guaran Fantstica", Category = "Beverages", UnitPrice = 4.5000M, UnitsInStock = 20 }, { ProductID = 25, ProductName = "NuNuCa Nu-Nougat-Creme", Category = "Confections", UnitPrice = 14.0000M, UnitsInStock = 76 }, { ProductID = 26, ProductName = "Gumbr Gummibrchen", Category = "Confections", UnitPrice = 31.2300M, UnitsInStock = 15 }, { ProductID = 27, ProductName = "Schoggi Schokolade", Category = "Confections", UnitPrice = 43.9000M, UnitsInStock = 49 }, { ProductID = 28, ProductName = "Rssle Sauerkraut", Category = "Produce", UnitPrice = 45.6000M, UnitsInStock = 26 }, { ProductID = 29, ProductName = "Thringer Rostbratwurst", Category = "Meat/Poultry", UnitPrice = 123.7900M, UnitsInStock = 0 }, { ProductID = 30, ProductName = "Nord-Ost Matjeshering", Category = "Seafood", UnitPrice = 25.8900M, UnitsInStock = 10 }, { ProductID = 31, ProductName = "Gorgonzola Telino", Category = "Dairy Products", UnitPrice = 12.5000M, UnitsInStock = 0 }, { ProductID = 32, ProductName = "Mascarpone Fabioli", Category = "Dairy Products", UnitPrice = 32.0000M, UnitsInStock = 9 }, { ProductID = 33, ProductName = "Geitost", Category = "Dairy Products", UnitPrice = 2.5000M, UnitsInStock = 112 }, { ProductID = 34, ProductName = "Sasquatch Ale", Category = "Beverages", UnitPrice = 14.0000M, UnitsInStock = 111 }, { ProductID = 35, ProductName = "Steeleye Stout", Category = "Beverages", UnitPrice = 18.0000M, UnitsInStock = 20 }, { ProductID = 36, ProductName = "Inlagd Sill", Category = "Seafood", UnitPrice = 19.0000M, UnitsInStock = 112 }, { ProductID = 37, ProductName = "Gravad lax", Category = "Seafood", UnitPrice = 26.0000M, UnitsInStock = 11 }, { ProductID = 38, ProductName = "Cte de Blaye", Category = "Beverages", UnitPrice = 263.5000M, UnitsInStock = 17 }, { ProductID = 39, ProductName = "Chartreuse verte", Category = "Beverages", UnitPrice = 18.0000M, UnitsInStock = 69 }, { ProductID = 40, ProductName = "Boston Crab Meat", Category = "Seafood", UnitPrice = 18.4000M, UnitsInStock = 123 }, { ProductID = 41, ProductName = "Jack's New England Clam Chowder", Category = "Seafood", UnitPrice = 9.6500M, UnitsInStock = 85 }, { ProductID = 42, ProductName = "Singaporean Hokkien Fried Mee", Category = "Grains/Cereals", UnitPrice = 14.0000M, UnitsInStock = 26 }, { ProductID = 43, ProductName = "Ipoh Coffee", Category = "Beverages", UnitPrice = 46.0000M, UnitsInStock = 17 }, { ProductID = 44, ProductName = "Gula Malacca", Category = "Condiments", UnitPrice = 19.4500M, UnitsInStock = 27 }, { ProductID = 45, ProductName = "Rogede sild", Category = "Seafood", UnitPrice = 9.5000M, UnitsInStock = 5 }, { ProductID = 46, ProductName = "Spegesild", Category = "Seafood", UnitPrice = 12.0000M, UnitsInStock = 95 }, { ProductID = 47, ProductName = "Zaanse koeken", Category = "Confections", UnitPrice = 9.5000M, UnitsInStock = 36 }, { ProductID = 48, ProductName = "Chocolade", Category = "Confections", UnitPrice = 12.7500M, UnitsInStock = 15 }, { ProductID = 49, ProductName = "Maxilaku", Category = "Confections", UnitPrice = 20.0000M, UnitsInStock = 10 }, { ProductID = 50, ProductName = "Valkoinen suklaa", Category = "Confections", UnitPrice = 16.2500M, UnitsInStock = 65 }, { ProductID = 51, ProductName = "Manjimup Dried Apples", Category = "Produce", UnitPrice = 53.0000M, UnitsInStock = 20 }, { ProductID = 52, ProductName = "Filo Mix", Category = "Grains/Cereals", UnitPrice = 7.0000M, UnitsInStock = 38 }, { ProductID = 53, ProductName = "Perth Pasties",

Category = "Meat/Poultry", UnitPrice = 32.8000M, UnitsInStock = 0 }, { ProductID = 54, ProductName = "Tourtire", Category = "Meat/Poultry", UnitPrice = 7.4500M, UnitsInStock = 21 }, { ProductID = 55, ProductName = "Pt chinois", Category = "Meat/Poultry", UnitPrice = 24.0000M, UnitsInStock = 115 }, { ProductID = 56, ProductName = "Gnocchi di nonna Alice", Category = "Grains/Cereals", UnitPrice = 38.0000M, UnitsInStock = 21 }, { ProductID = 57, ProductName = "Ravioli Angelo", Category = "Grains/Cereals", UnitPrice = 19.5000M, UnitsInStock = 36 }, { ProductID = 58, ProductName = "Escargots de Bourgogne", Category = "Seafood", UnitPrice = 13.2500M, UnitsInStock = 62 }, { ProductID = 59, ProductName = "Raclette Courdavault", Category = "Dairy Products", UnitPrice = 55.0000M, UnitsInStock = 79 }, { ProductID = 60, ProductName = "Camembert Pierrot", Category = "Dairy Products", UnitPrice = 34.0000M, UnitsInStock = 19 }, { ProductID = 61, ProductName = "Sirop d'rable", Category = "Condiments", UnitPrice = 28.5000M, UnitsInStock = 113 }, { ProductID = 62, ProductName = "Tarte au sucre", Category = "Confections", UnitPrice = 49.3000M, UnitsInStock = 17 }, { ProductID = 63, ProductName = "Vegie-spread", Category = "Condiments", UnitPrice = 43.9000M, UnitsInStock = 24 }, { ProductID = 64, ProductName = "Wimmers gute Semmelkndel", Category = "Grains/Cereals", UnitPrice = 33.2500M, UnitsInStock = 22 }, { ProductID = 65, ProductName = "Louisiana Fiery Hot Pepper Sauce", Category = "Condiments", UnitPrice = 21.0500M, UnitsInStock = 76 }, { ProductID = 66, ProductName = "Louisiana Hot Spiced Okra", Category = "Condiments", UnitPrice = 17.0000M, UnitsInStock = 4 }, { ProductID = 67, ProductName = "Laughing Lumberjack Lager", Category = "Beverages", UnitPrice = 14.0000M, UnitsInStock = 52 }, { ProductID = 68, ProductName = "Scottish Longbreads", Category = "Confections", UnitPrice = 12.5000M, UnitsInStock = 6 }, { ProductID = 69, ProductName = "Gudbrandsdalsost", Category = "Dairy Products", UnitPrice = 36.0000M, UnitsInStock = 26 }, { ProductID = 70, ProductName = "Outback Lager", Category = "Beverages", UnitPrice = 15.0000M, UnitsInStock = 15 }, { ProductID = 71, ProductName = "Flotemysost", Category = "Dairy Products", UnitPrice = 21.5000M, UnitsInStock = 26 }, { ProductID = 72, ProductName = "Mozzarella di Giovanni", Category = "Dairy Products", UnitPrice = 34.8000M, UnitsInStock = 14 }, { ProductID = 73, ProductName = "Rd Kaviar", Category = "Seafood", UnitPrice = 15.0000M, UnitsInStock = 101 }, { ProductID = 74, ProductName = "Longlife Tofu", Category = "Produce", UnitPrice = 10.0000M, UnitsInStock = 4 }, { ProductID = 75, ProductName = "Rhnbru Klosterbier", Category = "Beverages", UnitPrice = 7.7500M, UnitsInStock = 125 }, { ProductID = 76, ProductName = "Lakkalikri", Category = "Beverages", UnitPrice = 18.0000M, UnitsInStock = 57 }, { ProductID = 77, ProductName = "Original Frankfurter grne Soe", Category = "Condiments", UnitPrice = 13.0000M, UnitsInStock = 32 } }; }

Joins in Linq Inner Join ====================================== var innerJoinQuery = from category in categories join prod in products on category.ID equals prod.CategoryID select new { ProductName = prod.Name, Category = category.Name }; //produces flat sequence

Left Outer Join ====================================== var leftOuterJoinQuery = from category in categories join prod in products on category.ID equals prod.CategoryID into prodGroup from item in prodGroup.DefaultIfEmpty(new Product{Name = String.Empty, CategoryID = 0}) select new { CatName = category.Name, ProdName = item.Name };

Group Join ======================================= var innerGroupJoinQuery = from category in categories join prod in products on category.ID equals prod.CategoryID into prodGroup select new { CategoryName = category.Name, Products = prodGroup };

You might also like