It’s a data-driven world...you better know how to live in it.
Gone are the days when you could program for days, even weeks, without dealing with loads of data. But today, everything is about data. In fact, you’ll often have to work with data from more than one place...and in more than one format. Databases, XML, collections from other programs...it’s all part of the job of a good C# programmer. And that’s where LINQ comes in. LINQ not only lets you query data in a simple, intuitive way, but it lets you group data, and merge data from different data sources.
Objectville Paper Company wants to do a cross-promotion with Starbuzz Coffee. Starbuzz has a frequent-customer program where they keep track of which customers buy which drink and how often they buy it. Objectville Paper wants to figure out which of their customers are also Starbuzz regulars and send them a free mug and a coupon for their favorite coffee drink...and it’s up to you to combine the data and generate the list of customers to send mugs and coupons to.
Starbuzz keeps all their data in classes, grouped together in a big
List. But the Objectville data is in a database (from way back in Chapter 1). We want to find any Starbuzz customers ...