LINQ for Dummies Examples and Older Versions of C# Express

A number of people have written me about the examples in LINQ for Dummies not working with older versions of Visual C# Express. I’ve tried to become more proactive about telling people precisely which version of language products I use to write a book so there are fewer surprises, but this isn’t one of those books. In this case, I used Visual Studio 2008 Professional edition and Visual Studio Team System 2008 edition for testing purposesI definitely didn’t test it using Visual C# 2008 Express edition. In every case that I know of, when the reader upgraded to at least Visual Studio 2008 Standard edition and read through Chapter 1 to understand the LINQ usage requirements, the examples began to work.

Of course, many people don’t have the funds to buy Visual Studio 2008 (or any other version of Visual Studio for that matter). So, I’ve decided to check whether the problem example that most people write me about (Listing 2-1 on page 30) will work with Visual C# 2010 Express edition, which is a free download. Before you begin then, download and install Visual C# 2010 Express edition on your system using Microsoft’s directions. I’m assuming that you’re performing a default installationaccepting all of the default settings and not installing SQL Server.

Once you have Visual C# 2010 Express edition installed, download the source code (if necessary) and locate the \Chapter 02\SimpleFromQuery\SimpleFromQuery folder. In this folder you’ll find a file named SimpleFromQuery.csproj. Right click this file and choose Open With > Microsoft Visual C# 2010 Express from the context menu. You’ll see the Visual Studio Conversion Wizard start up as shown here.

VisualCSharp01

Follow the steps to convert the example to Visual Studio 2010 format. Use all of the default answers, including creating a backup of the original example, just in case you need it later. After you complete the conversion, press F5 or click Start Debugging. The example should compile and run. Click Test and you’ll see the results shown here.

VisualCSharp02

In short, if you’re having trouble getting the examples to run using an older version of Visual C# Express, try the latest version. It does appear to work fine. I’ll check the remaining book examples just to be certain. If you do encounter problems with any of the examples working with Visual C# Express 2010, please let me know at John@JohnMuellerBooks.com.

 

Author: John

John Mueller is a freelance author and technical editor. He has writing in his blood, having produced 99 books and over 600 articles to date. The topics range from networking to artificial intelligence and from database management to heads-down programming. Some of his current books include a Web security book, discussions of how to manage big data using data science, a Windows command -line reference, and a book that shows how to build your own custom PC. His technical editing skills have helped over more than 67 authors refine the content of their manuscripts. John has provided technical editing services to both Data Based Advisor and Coast Compute magazines. He has also contributed articles to magazines such as Software Quality Connection, DevSource, InformIT, SQL Server Professional, Visual C++ Developer, Hard Core Visual Basic, asp.netPRO, Software Test and Performance, and Visual Basic Developer. Be sure to read John’s blog at http://blog.johnmuellerbooks.com/. When John isn’t working at the computer, you can find him outside in the garden, cutting wood, or generally enjoying nature. John also likes making wine and knitting. When not occupied with anything else, he makes glycerin soap and candles, which comes in handy for gift baskets. You can reach John on the Internet at John@JohnMuellerBooks.com. John is also setting up a website at http://www.johnmuellerbooks.com/. Feel free to take a look and make suggestions on how he can improve it.