<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>Visual Studio 2008</title><link>http://blogs.vbcity.com/xtab/category/201.aspx</link><description>The next generation</description><managingEditor>Ged Mead</managingEditor><dc:language>et</dc:language><generator>.Text Version 0.95.2004.102</generator><item><dc:creator>Ged Mead</dc:creator><title>Your First VS 2008 WPF Application .... or not?</title><link>http://blogs.vbcity.com/xtab/archive/2007/11/27/8883.aspx</link><pubDate>Tue, 27 Nov 2007 14:13:00 GMT</pubDate><guid>http://blogs.vbcity.com/xtab/archive/2007/11/27/8883.aspx</guid><description>&lt;FONT face=Verdana size=2&gt;
&lt;P&gt;&amp;nbsp; So Visual Studio 2008 is finally here! After what seems like a long time using Betas, VS 2005 extensions and various other weirdly named WIPs, it's great that the full, final version has arrived.&lt;BR&gt;&lt;BR&gt;&amp;nbsp;If you haven't tried it yet and aren't ready to commit from your wallet then you'll probably be pleased to hear that VS 2008 also has a free, downloadable Express Edition. Well, "Editions" - as there are VB, C#, C++ and Web versions. The download site for the VB Express Edition is &lt;A href="http://www.microsoft.com/express/product/default.aspx"&gt;here&lt;/A&gt;. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;One of the very first things I did was to fire up a new WPF application :&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.xtabvbcity.plus.com/Blogs/WPFProblem1.jpg"&gt; &lt;/P&gt;
&lt;P&gt;&amp;nbsp; However, I was a bit surprised to find that as soon as I tried to run this project I had an immediate compilation error:&lt;/P&gt;&lt;BR&gt;
&lt;P&gt;&lt;IMG src="http://www.xtabvbcity.plus.com/Blogs/WPFProblem2.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; As the message says, "Option Strict On disallows implicit conversions from 'System.Windows.Application' to 'WpfApplication1.Application'. (Obviously the name of the WPF Application will be different if you have already changed the project name to something more meaningful). &lt;/P&gt;
&lt;P&gt;&amp;nbsp; Having got into the good habit of always starting out with Option Strict On I didn't really want to "fix" this problem by turning Option Strict Off. Luckily the solution for this little setback is simple.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Double click the error message in the Errors list so that you are taken to the MyWpfExtension.vb file, which is where the problem resides. You will see the all-too-familiar wavy blue line under the code:&lt;/P&gt;&lt;BR&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;Return Global.System.Windows.Application.Current&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Replace this with: &lt;/P&gt;&lt;FONT face="Courier New"&gt;
&lt;P&gt;Return CType(Global.System.Windows.Application.Current, Application) &lt;/P&gt;&lt;/FONT&gt;
&lt;P&gt;&amp;nbsp; which explicitly makes the required cast and you will be good to go.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Of course, this only fixes the current project. For a longer term fix, you can create a new template. To do this, first of all make the code change as described above. Then select Export Template from the File Menu in Visual Studio:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.xtabvbcity.plus.com/Blogs/WPFProblem3.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Accept the default settings in the&amp;nbsp;first window.&amp;nbsp; Then in the next window, edit the Template Name (I recommend that you create one with a name that indicates that it is a revised version). Add a description if desired. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;You can't actually change the output location from this window, so leave that as is (for now anyway).&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.xtabvbcity.plus.com/Blogs/WPFProblem4.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Click the Finish button and you will see the created template zip file in that default folder. Copy that newly created zip file and navigate to : &lt;BR&gt;My Documents\Visual Studio 2008\Templates\ProjectTemplates\Visual Basic&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Create a new folder in there and name it "Windows". Paste the zip file into this new folder. Don't unzip the file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Close down Visual Studio 2008 and re-open it. If all has gone according to plan, you will now see the additional template in the "My Templates" area. &lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.xtabvbcity.plus.com/Blogs/WPFProblem5.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;You can click on this to create a new WPF application that will run fine with Option Strict On. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;I'm sure this will be fixed in SP1, but it's one of those minor things that might throw you if you didn't know about it.&lt;/P&gt;&lt;/FONT&gt;&lt;img src ="http://blogs.vbcity.com/xtab/aggbug/8883.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Ged Mead</dc:creator><title>Visual Studio 2008 - Beta 2 now available for download</title><link>http://blogs.vbcity.com/xtab/archive/2007/08/01/8566.aspx</link><pubDate>Wed, 01 Aug 2007 13:23:00 GMT</pubDate><guid>http://blogs.vbcity.com/xtab/archive/2007/08/01/8566.aspx</guid><wfw:comment>http://blogs.vbcity.com/xtab/comments/8566.aspx</wfw:comment><comments>http://blogs.vbcity.com/xtab/archive/2007/08/01/8566.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.vbcity.com/xtab/comments/commentRss/8566.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/xtab/services/trackbacks/8566.aspx</trackback:ping><description>&lt;P&gt;&amp;nbsp;&lt;FONT face=Verdana size=2&gt; The latest (and final) Beta for what we used to know as Visual Studio CodeName Orcas has now been made available.&amp;nbsp;&amp;nbsp; Visual Studio 2008 Beta 2 can be downloaded from &lt;/FONT&gt;&lt;A href="http://msdn2.microsoft.com/en-us/vstudio/default.aspx"&gt;&lt;FONT face=Verdana size=2&gt;here&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana size=2&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp; According to the team at Microsoft, this version&amp;nbsp;is now feature complete.&amp;nbsp; The next version - &amp;nbsp;RTM version -&amp;nbsp;will ship before the end of the year and the final product release is scheduled for February 2008.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&amp;nbsp; Although still a hefty download, it's less bulky than the previous Beta and the Community Technology Preview (CTP) versions.&amp;nbsp;&amp;nbsp; As with all Betas, the best advice is to install it on a development machine that you don't mind reformatting if necessary.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/xtab/aggbug/8566.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Ged Mead</dc:creator><title>Visual Studio Orcas (VS 2008): Project Saves and Intellisense</title><link>http://blogs.vbcity.com/xtab/archive/2007/06/15/8449.aspx</link><pubDate>Fri, 15 Jun 2007 11:18:00 GMT</pubDate><guid>http://blogs.vbcity.com/xtab/archive/2007/06/15/8449.aspx</guid><wfw:comment>http://blogs.vbcity.com/xtab/comments/8449.aspx</wfw:comment><comments>http://blogs.vbcity.com/xtab/archive/2007/06/15/8449.aspx#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://blogs.vbcity.com/xtab/comments/commentRss/8449.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/xtab/services/trackbacks/8449.aspx</trackback:ping><description>&lt;FONT face=Verdana size=2&gt;
&lt;P&gt;I've spent most of my free Orcas experimentation time on Linq so far, and the occasional foray into the wild world of WPF. I really want to get to grips with WPF in the next few months. It's not going to be easy stuff, that's for sure, but hopefully the results - graphically at least - will be worth the effort.&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Saving Project Files&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;I've noticed a few changes in the Orcas/2008 IDE. It seems that we've gone full circle again on project file saving. In Orcas, your new project is automatically saved to the hard drive - whereas in VB 2005 you have that kind of temporary system where you don't get asked to decide to save to a path of your choice until the first time you hit the save button or save menu item. Having got used to the 2005 way, I've actually come to prefer it . It can be a bit dispiriting to see just how many projects you can happily discard as worthless, but it doesn't half cut down on the search task when you want to go back later and find a worthwhile project in that huge mass of low grade Solution goo. &lt;/P&gt;
&lt;P&gt;&lt;U&gt;Intellisense&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;Intellisense has just come of age! Orcas Intellisense is just absolutely excellent. Not just in the Linq queries, where it is of course particularly useful in keeping your head straight on what you're trying to achieve either. For standard code bashing jobs, Intellisense has been refined. &lt;/P&gt;
&lt;P&gt;First off, you only get a dropdown list of possible selections that begin with the letter(s) you have typed so far. The list gets further and further filtered as you type. In 2005 there is some filtering, but it's simply not as slick as this.&lt;/P&gt;
&lt;P&gt;But the thing I like the best about it is that it remembers what your last choice was for any selection. So to take an example, the first time you start to type:&lt;BR&gt;&lt;FONT face="Courier New" size=2&gt;Console.W&lt;/FONT&gt;&lt;BR&gt;&lt;BR&gt;you will get all Console methods beginning with W, as you would expect. Let's assume that you select Console.WriteLine.&lt;BR&gt;You then go off and use Intellisense for other code insertion, using different initial letters. When you next select "Console.W" you are offered your last recorded choice - specifically in this case "Console.WriteLine" which happens to be way down the list of W choices. I don't have VS 2005 on the machine I'm writing this on, but as far as I remember, in 2005 you are offered the first match that begins with your current letter, not the one you last used. I've found this to be really useful. &lt;/P&gt;&lt;/FONT&gt;&lt;img src ="http://blogs.vbcity.com/xtab/aggbug/8449.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Ged Mead</dc:creator><title>Linq To SQL Hands On Lab</title><link>http://blogs.vbcity.com/xtab/archive/2007/06/12/8412.aspx</link><pubDate>Tue, 12 Jun 2007 09:34:00 GMT</pubDate><guid>http://blogs.vbcity.com/xtab/archive/2007/06/12/8412.aspx</guid><wfw:comment>http://blogs.vbcity.com/xtab/comments/8412.aspx</wfw:comment><comments>http://blogs.vbcity.com/xtab/archive/2007/06/12/8412.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.vbcity.com/xtab/comments/commentRss/8412.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/xtab/services/trackbacks/8412.aspx</trackback:ping><description>&lt;P&gt;&amp;nbsp; &lt;FONT face=Verdana size=2&gt;As mentioned earlier, there is a Hands On Lab available from Microsoft which walks you through some basic (and not so basic!) steps in using Linq To SQL.&amp;nbsp; The download page is &lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyID=E7FA5E3A-F8B2-4F77-BBCD-B5B978402DD1&amp;amp;displaylang=en"&gt;here.&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;FONT face=Verdana size=2&gt;
&lt;P&gt;&amp;nbsp; Here are&amp;nbsp;a few observations on the Linq To SQL Hands on Labs that I jotted down while I was working through it :&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;B&gt;So Much Reassurance is, umm, Reassuring!&lt;/B&gt;&lt;/U&gt;&lt;BR&gt;&amp;nbsp; One aspect of the Labs that I particularly liked was that the narrative was full of helpful notes to reassure me as I worked my way&amp;nbsp;through it. The kind of thing included is "Note: .. the new row will not show in the results" and "Note:As in the last task, no changes have actually been sent to the database yet". I think notes at this level are extremely useful - and far too often technical authors forget that there is a wide range of understanding out there in their reading public. As they are side notes, readers who don't need the info can skim or ignore them; the rest of us can read them and be reassured that we haven't missed or misunderstood something. &lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;B&gt;So Many Customers Can Be Confusing! &lt;/B&gt;&lt;/U&gt;&lt;BR&gt;&amp;nbsp; I decided that I would create a brand new Orcas project and solution for each part of the Lab. That way, I thought, I could go back later when it all became fuzzy in my memory and just home in on one particular technique. It also meant that I got a bit of learning reinforcement as I went through the initial steps again each time &lt;BR&gt;&lt;BR&gt;&amp;nbsp; Just be aware though that in Exercises 2 and 3 (Internals) you hand-build your own Customer class (and very tricky stuff it is, too, although it is clearly explained). However, when you move on to Exercise 4 you need to revert to the Customer table from the dbml file, i.e. the one you created the easy way back in Exercise 1. If you don't, you'll have a problem or two when you try and use the demo code in Exercise 4. It's not rocket science level stuff, but may give you pause if you're not aware. &lt;/P&gt;
&lt;P&gt;&amp;nbsp; And at the risk of insulting your intelligence, you need to add the further two Tables from Northwind - Order Details and Products - to the existing dbml file, so you eventually have all five tables available.&lt;/P&gt;
&lt;P&gt;&lt;B&gt;&lt;U&gt;Some&amp;nbsp;Typos&amp;nbsp;and Missing Link&lt;/U&gt;&lt;/B&gt; 
&lt;P&gt;&amp;nbsp; It's rare day when you can work through a whole set of printed exercises and not get stung by a few typos in the code. The Linq To SQL HOL is generally pretty good on this score, but be aware that in Exercise 4, Task 2 there's a minor blip that's pretty obvious as soon as you look at it (and doesn't really undermine anything important in the learning curve). The formatted WriteLine string should of course be: 
&lt;DIV style="MARGIN-LEFT: 10pt; MARGIN-RIGHT: 2pt"&gt;
&lt;DIV style="FONT-SIZE: 15px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'"&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;'&amp;nbsp;&amp;nbsp;Display the result&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;For&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Each&lt;/FONT&gt; cust&lt;FONT color=#0000ff&gt; In&lt;/FONT&gt; CACustomers&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Console.WriteLine(&lt;FONT color=#a31515&gt;"{0}, {1}, {2}, {3}"&lt;/FONT&gt;, _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cust.CustomerID, cust.CompanyName, cust.ContactName, cust.Orders.Count)&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Next&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;i.e. the second "{2}" changed to "{3}". 
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; It might also be worth mentioning that if you want to see the (not yet persisted) Update to the contactname, which is what the next Task -Task 5 - does, then you should copy and paste the above block again to bottom(ish) of Sub Main. That way you'll get both versions displayed one after the other.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I also had a problem with Tasks 1 - 4 of Exercise 5, in that I couldn't track down the SQL Server database they were using. I think this may be available via SQL Server Express or the VB Express Starter Kits, but it doesn't seem to be linked from the download page and I didn't pursue it. So, I did skip actually carrying out those tasks.&amp;nbsp;&amp;nbsp; (I think it's available as part of one of the Starter Kits in VB 2005, but not included with the Orcas Beta 1 - I'm sure it will probably all come together once the final version is shipped).&lt;/P&gt;
&lt;P&gt;Overall though, I&amp;nbsp;found the whole package to be well written, clear to follow and very useful. I'm sure I'll be dipping back into it for help in the future and, with the current&amp;nbsp;lack of VB based Linq articles and books,&amp;nbsp;this Hands On Lab is very welcome.&lt;/P&gt;&lt;/FONT&gt;&lt;img src ="http://blogs.vbcity.com/xtab/aggbug/8412.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Ged Mead</dc:creator><title>LINQ To SQL(1)</title><link>http://blogs.vbcity.com/xtab/archive/2007/06/10/8404.aspx</link><pubDate>Sun, 10 Jun 2007 10:30:00 GMT</pubDate><guid>http://blogs.vbcity.com/xtab/archive/2007/06/10/8404.aspx</guid><description>&lt;FONT face=Verdana size=2&gt;
&lt;P&gt;   I'm still very much just feeling my way tentatively forward with LINQ to SQL, but my first reaction is one of relief that it really is very similar to the LINQ to Objects approach and so the learning curve is minimal. Of course, there is the small matter of connecting to database that isn't a factor in LINQ to Objects, but so far the use of DataContext has been painless. (Hope I'm not celebrating too soon!)&lt;/P&gt;
&lt;P&gt;   A new Hands On Labs that is now available from the Visual Basic Team &lt;A title="LINQ to SQL Hands On Lab" href="http://vbfeeds.com/post.aspx?id=3435"&gt;&lt;/A&gt;is very good and I recommend you download it and give it a try.   You can get it via the VBFeeds web site &lt;A href="http://vbfeeds.com/post.aspx?id=3435"&gt;here&lt;/A&gt;.   As I don't think I can improve on that resource, I won't run through a whole list of examples as I did with LINQ To Objects. May be better if I just highlight some points that caught my attention. (This latest Hands on Lab, by the way, has been updated to run under Orcas Beta 1.)&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Distinct&lt;/U&gt; &lt;BR&gt;I don't know about you, but I find it hard to think of "Distinct" without the prefix of "Select" as in the standard SQL Query syntax of "SELECT DISTINCT". For whatever reason, in LINQ to SQL you do have to pull them apart though as the compiler won't recognise the phrase "Select Distinct" in a LINQ to SQL Query. &lt;/P&gt;
&lt;P&gt;  If I can claim to have done enough LINQ work to develop habits, I guess I'd say that I'm in the habit of using the query format of: (Pseudocode)&lt;/P&gt;
&lt;P&gt;Dim x = From element in collection _ &lt;BR&gt;Where typedobject = SomeValue _ &lt;BR&gt;Order By somecolumn _ Select expression &lt;/P&gt;
&lt;P&gt;i.e. writing the guts of the query before finishing it off with the Select line. It seems though that with a LINQ to SQL Query that uses the Distinct keyword, the format has to be:&lt;/P&gt;
&lt;P&gt;
&lt;DIV style="MARGIN-LEFT: 10pt; MARGIN-RIGHT: 2pt"&gt;
&lt;DIV style="FONT-SIZE: 15px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'"&gt;&lt;FONT color=#0000ff&gt;Dim&lt;/FONT&gt; ids =&lt;FONT color=#0000ff&gt; From&lt;/FONT&gt; Customer&lt;FONT color=#0000ff&gt; In&lt;/FONT&gt; db.Customers _&lt;BR&gt;&lt;FONT color=#0000ff&gt;                  From&lt;/FONT&gt; emp&lt;FONT color=#0000ff&gt; In&lt;/FONT&gt; db.Employees _&lt;BR&gt;&lt;FONT color=#0000ff&gt;                  Where&lt;/FONT&gt; Customer.City = emp.City _&lt;BR&gt;&lt;FONT color=#0000ff&gt;                   Select&lt;/FONT&gt; emp.EmployeeID&lt;FONT color=#0000ff&gt; Distinct&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;or: 
&lt;DIV style="MARGIN-LEFT: 10pt; MARGIN-RIGHT: 2pt"&gt;
&lt;DIV style="FONT-SIZE: 15px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'"&gt;&lt;FONT color=#0000ff&gt;Dim&lt;/FONT&gt; ids =&lt;FONT color=#0000ff&gt; From&lt;/FONT&gt; Customer&lt;FONT color=#0000ff&gt; In&lt;/FONT&gt; db.Customers _&lt;BR&gt;&lt;FONT color=#0000ff&gt;                  From&lt;/FONT&gt; emp&lt;FONT color=#0000ff&gt; In&lt;/FONT&gt; db.Employees _&lt;BR&gt;&lt;FONT color=#0000ff&gt;                  Where&lt;/FONT&gt; Customer.City = emp.City _&lt;BR&gt;&lt;FONT color=#0000ff&gt;                   Select&lt;/FONT&gt; emp.EmployeeID _
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;&lt;FONT color=#0000ff&gt;Distinct&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;BR&gt;of course.
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Just as a minor note of warning, if you do use this query format:&lt;/P&gt;
&lt;DIV style="MARGIN-LEFT: 10pt; MARGIN-RIGHT: 2pt"&gt;
&lt;DIV style="FONT-SIZE: 15px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'"&gt;&lt;FONT color=#0000ff&gt;  Dim&lt;/FONT&gt; ids =&lt;FONT color=#0000ff&gt; From&lt;/FONT&gt; Customer&lt;FONT color=#0000ff&gt; In&lt;/FONT&gt; db.Customers _&lt;BR&gt;&lt;FONT color=#0000ff&gt;                  From&lt;/FONT&gt; emp&lt;FONT color=#0000ff&gt; In&lt;/FONT&gt; db.Employees _&lt;BR&gt;&lt;FONT color=#0000ff&gt;                  Where&lt;/FONT&gt; Customer.City = emp.City _&lt;BR&gt;&lt;FONT color=#0000ff&gt;                  Distinct&lt;/FONT&gt; _&lt;BR&gt;&lt;FONT color=#0000ff&gt;                   Select&lt;/FONT&gt; emp.EmployeeID&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;where the Distinct keyword is inserted prior to the Select keyword, you won't get a syntax error flagged up and the query will compile. However you won't get a distinct list as the result; you'll get all EmployeeIDs (repeated) that match the criteria.&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Syntax Checking&lt;/U&gt;&lt;BR&gt;Something else you have to get used to while writing out LINQ queries is the syntax editor barking at you halfway through some queries. This might just be because I'm still working with a Beta version and may not happen once we get to RTM.   However it can be off-putting if you think you've written the code correctly (but haven't finished it) and you get various error messages that subsequently prove not to be errors. &lt;/P&gt;
&lt;P&gt;One self-inflicted error (that actually is an error!) is to forget to insert the space and underscore at the end of a line in an incomplete LINQ Query. Sometimes when you're concentrating so hard on getting the syntax just right this is a really easy thing to forget. The error messages vary, but never refer to the missing underscore, but - understandably - refer to the next line of code which the compiler won't be able to understand because of the missing punctuation mark. So the first thing to check before trying to figure out what the supposed error might be is that you haven't forgotten that space and underscore. It'll soon become second nature - trust me!&lt;/P&gt;
&lt;P&gt;Going back to the Hands On Labs, I quite like the way it begins by demonstrating how easy it is to use the built-in LINQ To SQL File Template to create a working query quickly and easily. It then digs deep down into the code to show how this is done under the hood and how you can hand build equivalents yourself if you want to. Personally, having worked through their examples, I was very happy to accept their advice which is: &lt;BR&gt;&lt;I&gt;  "Generating the database table relationships and object model can be tedious and prone to error. We do NOT advise you take that approach but it's included in this lab for education.....&lt;BR&gt;The easiest and best option is to use the new designer with its seamless Visual Studio integration."&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;Yay to that!&lt;/P&gt;&lt;/FONT&gt;&lt;img src ="http://blogs.vbcity.com/xtab/aggbug/8404.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Ged Mead</dc:creator><title>VB 9, Orcas, VB 2008, VB 10, VBx, Silverlight - Confused?  Help is at hand!</title><link>http://blogs.vbcity.com/xtab/archive/2007/06/08/8403.aspx</link><pubDate>Fri, 08 Jun 2007 16:00:00 GMT</pubDate><guid>http://blogs.vbcity.com/xtab/archive/2007/06/08/8403.aspx</guid><wfw:comment>http://blogs.vbcity.com/xtab/comments/8403.aspx</wfw:comment><comments>http://blogs.vbcity.com/xtab/archive/2007/06/08/8403.aspx#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://blogs.vbcity.com/xtab/comments/commentRss/8403.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/xtab/services/trackbacks/8403.aspx</trackback:ping><description>&lt;P&gt;&amp;nbsp; &lt;FONT face=Verdana size=2&gt;I'm not usually a fan of blogs that link to blogs, but I thought that&amp;nbsp;&lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/vbteam/archive/2007/06/07/what-is-the-difference-between-vb-9-vbx-and-silverlight.aspx"&gt;&lt;FONT face=Verdana size=2&gt;this item&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana size=2&gt; by Scott Wisniewski of the Visual Basic Team is so useful in clarifying the situation that I would flag it up.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&amp;nbsp; We're all used to mentally switching from Codenames like Orcas to the final version names (which now is VB 2008, apparently), but this year the ongoing stream of new products and additions to current ones is more&amp;nbsp; mind-boggling than at any previous time that I can remember.&amp;nbsp;&amp;nbsp; So it's good to have an explanation like that one that walks through it in very clear terms.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&amp;nbsp; I think it might be useful&amp;nbsp;to have an&amp;nbsp;&amp;nbsp;equivalent &lt;EM&gt;&lt;STRONG&gt;clear&lt;/STRONG&gt;&lt;/EM&gt; explanation of the various .NET framework numbers - 1.0, 1.1, 2, 3 and now 3.5 - and where they all fit in to the big picture.&amp;nbsp;&amp;nbsp;&amp;nbsp; There's probably at least one already out there somewhere.&amp;nbsp; I just haven't come across it yet, but would welcome any links if you have any.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/xtab/aggbug/8403.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Ged Mead</dc:creator><title>LINQ To Objects - Part 3</title><link>http://blogs.vbcity.com/xtab/archive/2007/05/20/8293.aspx</link><pubDate>Sun, 20 May 2007 09:03:00 GMT</pubDate><guid>http://blogs.vbcity.com/xtab/archive/2007/05/20/8293.aspx</guid><description>&lt;P&gt;&lt;FONT face=Verdana&gt;  &lt;FONT size=2&gt; Although&lt;/FONT&gt; &lt;FONT size=2&gt;some of the queries we saw at the end of &lt;A href="http://blogs.vbcity.com/xtab/archive/2007/05/10/8278.aspx"&gt;Part 2&lt;/A&gt; are quite impressive - and light years easier than doing it with Loops and If/Then tests - there are still more improvements to come.   Let's take the situation where you want to&lt;/FONT&gt; &lt;FONT size=2&gt;run Join queries across two separate data sources.  This is something you'll commonly do with Access or SQL Server, etc, data sources but not something you'd automatically think of doing with, for example, a couple of collections.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;   To demonstrate this, we can use a collection of objects from the Person class that we created earlier, together with a new Class that contains a field or fields that we can join them on. The scenario I'm going to use is that we run courses in the UK and in Belgium, so we will have a class named "Course". Here is the code for that class: &lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #800040 1px solid; BORDER-TOP: #800040 1px solid; MARGIN-LEFT: 10pt; BORDER-LEFT: #800040 1px solid; MARGIN-RIGHT: 2pt; BORDER-BOTTOM: #800040 1px solid"&gt;
&lt;DIV style="FONT-SIZE: 10pt; BORDER-BOTTOM: #800040 1px solid" onclick="var i=this.sel,j;if(i==this.selold)return;var sh=new Array('none',''),o=this.parentNode;j=i==0?0:1;this.selold=i;o.childNodes[1].style.display=sh[j];o.childNodes[2].style.display=sh[1-j];o=o.childNodes[1];var h =o.offsetHeight;o.style.height=i==1?'150pt':'';if(i==1 &amp;&amp; o.offsetHeight&gt;h)o.style.height=h;" sel="1" selold="1"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy &lt;/A&gt;&lt;INPUT onclick=parentNode.sel=0 type=button value=Hide&gt;&lt;INPUT onclick=parentNode.sel=1 type=button value=Scroll&gt;&lt;INPUT onclick=parentNode.sel=2 type=button value=Full&gt;&lt;/DIV&gt;
&lt;DIV style="FONT-SIZE: 15px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'; HEIGHT: 150px; BACKGROUND-COLOR: #ffffb7"&gt;&lt;FONT color=#0000ff&gt;Public&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Class&lt;/FONT&gt; Course&lt;BR&gt;&lt;FONT color=#0000ff&gt;    Private&lt;/FONT&gt; m_Title&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; String&lt;/FONT&gt; =&lt;FONT color=#a31515&gt; "Not Known"&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;    Private&lt;/FONT&gt; m_Location&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; String&lt;/FONT&gt; =&lt;FONT color=#a31515&gt; "Not Known"&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;    Private&lt;/FONT&gt; m_StartDate&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt; DateTime = Today&lt;BR&gt;&lt;FONT color=#0000ff&gt;    Private&lt;/FONT&gt; m_DurationDays&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Integer&lt;/FONT&gt; = 1&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;    Property&lt;/FONT&gt; Title()&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; String&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;        Get&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;            Return&lt;/FONT&gt; m_Title&lt;BR&gt;&lt;FONT color=#0000ff&gt;        End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Get&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;        Set&lt;/FONT&gt;(&lt;FONT color=#0000ff&gt;ByVal&lt;/FONT&gt; value&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; String&lt;/FONT&gt;)&lt;BR&gt;            m_Title = value&lt;BR&gt;&lt;FONT color=#0000ff&gt;        End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Set&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;    End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Property&lt;BR&gt;&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;    Property&lt;/FONT&gt; Location()&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; String&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;        Get&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;            Return&lt;/FONT&gt; m_Location&lt;BR&gt;&lt;FONT color=#0000ff&gt;        End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Get&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;        Set&lt;/FONT&gt;(&lt;FONT color=#0000ff&gt;ByVal&lt;/FONT&gt; value&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; String&lt;/FONT&gt;)&lt;BR&gt;            m_Location = value&lt;BR&gt;&lt;FONT color=#0000ff&gt;        End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Set&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;    End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Property&lt;BR&gt;&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;    Property&lt;/FONT&gt; StartDate()&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt; DateTime&lt;BR&gt;&lt;FONT color=#0000ff&gt;        Get&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;            Return&lt;/FONT&gt; m_StartDate&lt;BR&gt;&lt;FONT color=#0000ff&gt;        End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Get&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;        Set&lt;/FONT&gt;(&lt;FONT color=#0000ff&gt;ByVal&lt;/FONT&gt; value&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt; DateTime)&lt;BR&gt;            m_StartDate = value&lt;BR&gt;&lt;FONT color=#0000ff&gt;        End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Set&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;    End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Property&lt;BR&gt;&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;    Property&lt;/FONT&gt; DurationDays()&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Integer&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;        Get&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;            Return&lt;/FONT&gt; m_DurationDays&lt;BR&gt;&lt;FONT color=#0000ff&gt;        End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Get&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;        Set&lt;/FONT&gt;(&lt;FONT color=#0000ff&gt;ByVal&lt;/FONT&gt; value&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Integer&lt;/FONT&gt;)&lt;BR&gt;            m_DurationDays = value&lt;BR&gt;&lt;FONT color=#0000ff&gt;        End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Set&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;    End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Property&lt;BR&gt;&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;    Public&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Overrides&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Function&lt;/FONT&gt; ToString()&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; String&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;        Return&lt;/FONT&gt; m_Title &amp;&lt;FONT color=#a31515&gt; " : "&lt;/FONT&gt; &amp; m_Location&lt;BR&gt;&lt;FONT color=#0000ff&gt;    End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Function&lt;BR&gt;&lt;BR&gt;End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Class&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV style="DISPLAY: none; BACKGROUND-COLOR: #ffffb7"&gt;&lt;B&gt;. . .&lt;/B&gt;&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;And, as I'm sure you'll realise, we will use the Location Property in the Course class as the field to join the HomeTown property of the Person class - the purpose of this imaginary scenario being that we can invite potential students to attend courses in their home town.&lt;/P&gt;
&lt;P&gt;As we did in earlier examples for the Person class, we can create a simple array of Course objects:&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #800040 1px solid; BORDER-TOP: #800040 1px solid; MARGIN-LEFT: 10pt; BORDER-LEFT: #800040 1px solid; MARGIN-RIGHT: 2pt; BORDER-BOTTOM: #800040 1px solid"&gt;
&lt;DIV style="FONT-SIZE: 10pt; BORDER-BOTTOM: #800040 1px solid" onclick="var i=this.sel,j;if(i==this.selold)return;var sh=new Array('none',''),o=this.parentNode;j=i==0?0:1;this.selold=i;o.childNodes[1].style.display=sh[j];o.childNodes[2].style.display=sh[1-j];o=o.childNodes[1];var h =o.offsetHeight;o.style.height=i==1?'150pt':'';if(i==1 &amp;&amp; o.offsetHeight&gt;h)o.style.height=h;" sel="2" selold="2"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy &lt;/A&gt;&lt;INPUT onclick=parentNode.sel=0 type=button value=Hide&gt;&lt;INPUT onclick=parentNode.sel=1 type=button value=Scroll&gt;&lt;INPUT onclick=parentNode.sel=2 type=button value=Full&gt;&lt;/DIV&gt;
&lt;DIV style="FONT-SIZE: 15px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'; BACKGROUND-COLOR: #ffffb7"&gt;&lt;FONT color=#0000ff&gt;Function&lt;/FONT&gt; CreateCourses()&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt; Array&lt;BR&gt;&lt;FONT color=#0000ff&gt;        Dim&lt;/FONT&gt; SomeCourses()&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt; Course = {&lt;FONT color=#0000ff&gt;New&lt;/FONT&gt; Course&lt;FONT color=#0000ff&gt; With&lt;/FONT&gt; {.Title =&lt;FONT color=#a31515&gt; "VB 2005"&lt;/FONT&gt;, _&lt;BR&gt;            .Location =&lt;FONT color=#a31515&gt; "Leeds"&lt;/FONT&gt;, .StartDate =&lt;FONT color=#0000ff&gt; New&lt;/FONT&gt; DateTime(2007, 8, 8), .DurationDays = 7}, _&lt;BR&gt;&lt;FONT color=#0000ff&gt;        New&lt;/FONT&gt; Course&lt;FONT color=#0000ff&gt; With&lt;/FONT&gt; {.Title =&lt;FONT color=#a31515&gt; "Java"&lt;/FONT&gt;, .Location =&lt;FONT color=#a31515&gt; "Ghent"&lt;/FONT&gt;, .StartDate =&lt;FONT color=#0000ff&gt; New&lt;/FONT&gt; DateTime(2007, 12, 1), _&lt;BR&gt;            .DurationDays = 14}, _&lt;BR&gt;&lt;FONT color=#0000ff&gt;        New&lt;/FONT&gt; Course&lt;FONT color=#0000ff&gt; With&lt;/FONT&gt; {.Title =&lt;FONT color=#a31515&gt; "Ajax"&lt;/FONT&gt;, .Location =&lt;FONT color=#a31515&gt; "Manchester"&lt;/FONT&gt;, .StartDate =&lt;FONT color=#0000ff&gt; New&lt;/FONT&gt; DateTime(2008, 1, 13), _&lt;BR&gt;            .DurationDays = 10}, _&lt;BR&gt;&lt;FONT color=#0000ff&gt;        New&lt;/FONT&gt; Course&lt;FONT color=#0000ff&gt; With&lt;/FONT&gt; {.Title =&lt;FONT color=#a31515&gt; "Classic VB"&lt;/FONT&gt;, .Location =&lt;FONT color=#a31515&gt; "Leeds"&lt;/FONT&gt;, .StartDate =&lt;FONT color=#0000ff&gt; New&lt;/FONT&gt; DateTime(2006, 2, 2), _&lt;BR&gt;            .DurationDays = 10}, _&lt;BR&gt;&lt;FONT color=#0000ff&gt;        New&lt;/FONT&gt; Course&lt;FONT color=#0000ff&gt; With&lt;/FONT&gt; {.Title =&lt;FONT color=#a31515&gt; "SQL Server 2005"&lt;/FONT&gt;, .StartDate =&lt;FONT color=#0000ff&gt; New&lt;/FONT&gt; DateTime(2008, 5, 6), _&lt;BR&gt;            .Location =&lt;FONT color=#a31515&gt; "London"&lt;/FONT&gt;, .DurationDays = 12}}&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;        Return&lt;/FONT&gt; SomeCourses&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;    End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Function&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV style="DISPLAY: none; BACKGROUND-COLOR: #ffffb7"&gt;&lt;B&gt;. . .&lt;/B&gt;&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;   Note that for demo purposes I've included a course location in London, a place which none of our current Persons have their HomeTown, and also a course start date which has already passed.   We can use these for validation purposes in our queries.&lt;/P&gt;
&lt;P&gt;   First, we need to create the two arrays to query on:&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #800040 1px solid; BORDER-TOP: #800040 1px solid; MARGIN-LEFT: 10pt; BORDER-LEFT: #800040 1px solid; MARGIN-RIGHT: 2pt; BORDER-BOTTOM: #800040 1px solid"&gt;
&lt;DIV style="FONT-SIZE: 10pt; BORDER-BOTTOM: #800040 1px solid"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy &lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="FONT-SIZE: 15px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'; BACKGROUND-COLOR: #ffffb7"&gt;&lt;FONT color=#0000ff&gt;Public&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Class&lt;/FONT&gt; Form1&lt;BR&gt;&lt;FONT color=#0000ff&gt;    Dim&lt;/FONT&gt; People()&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt; Person&lt;BR&gt;&lt;FONT color=#0000ff&gt;    Dim&lt;/FONT&gt; Courses()&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt; Course&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;    Private&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Sub&lt;/FONT&gt; Form1_Load(&lt;FONT color=#0000ff&gt;ByVal&lt;/FONT&gt; sender&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Object&lt;/FONT&gt;,&lt;FONT color=#0000ff&gt; ByVal&lt;/FONT&gt; e&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt; System.EventArgs)&lt;FONT color=#0000ff&gt; Handles&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Me&lt;/FONT&gt;.Load&lt;BR&gt;&lt;FONT color=#008000&gt;        '  Get some data to work with&lt;/FONT&gt;&lt;BR&gt;        People = CreateDataVB9_3()&lt;FONT color=#008000&gt;&lt;/FONT&gt;&lt;BR&gt;        Courses = CreateCourses()&lt;FONT color=#0000ff&gt;&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;    End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Sub&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;And then we can run a query that matches all Persons whose HomeTowns are located in a place where we hold a course (reagrdless of course date): &lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #800040 1px solid; BORDER-TOP: #800040 1px solid; MARGIN-LEFT: 10pt; BORDER-LEFT: #800040 1px solid; MARGIN-RIGHT: 2pt; BORDER-BOTTOM: #800040 1px solid"&gt;
&lt;DIV style="FONT-SIZE: 10pt; BORDER-BOTTOM: #800040 1px solid"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy &lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="FONT-SIZE: 15px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'; BACKGROUND-COLOR: #ffffb7"&gt;&lt;FONT color=#0000ff&gt;  Dim&lt;/FONT&gt; Students =&lt;FONT color=#0000ff&gt; From&lt;/FONT&gt; P&lt;FONT color=#0000ff&gt; In&lt;/FONT&gt; People, C&lt;FONT color=#0000ff&gt; In&lt;/FONT&gt; Courses _&lt;BR&gt;&lt;FONT color=#0000ff&gt;        Where&lt;/FONT&gt; P.HomeTown = C.Location _&lt;BR&gt;&lt;FONT color=#0000ff&gt;        Order&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; By&lt;/FONT&gt; C.Location _&lt;BR&gt;&lt;FONT color=#0000ff&gt;        Select&lt;/FONT&gt; P.Forename, P.Surname, P.HomeTown, C.Title, C.Location&lt;BR&gt;&lt;BR&gt;        Console.WriteLine(&lt;FONT color=#a31515&gt;"Potential Students:"&lt;/FONT&gt;)&lt;BR&gt;&lt;FONT color=#0000ff&gt;        For&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Each&lt;/FONT&gt; Potential&lt;FONT color=#0000ff&gt; In&lt;/FONT&gt; Students&lt;BR&gt;&lt;FONT color=#0000ff&gt;            With&lt;/FONT&gt; Potential&lt;BR&gt;                Console.WriteLine(&lt;FONT color=#0000ff&gt;String&lt;/FONT&gt;.Format(&lt;FONT color=#a31515&gt;"{0} {1} From {2} - {3} Course in {4}"&lt;/FONT&gt;, .Forename, _&lt;BR&gt;                      .Surname, .HomeTown, .Title, .Location))&lt;BR&gt;&lt;FONT color=#0000ff&gt;            End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; With&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;        Next&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;  A lot of this will be familiar from the earlier examples. We look into both the Persons and the Courses arrays and find those cases where the Person's HomeTown matches the Course's Location. &lt;BR&gt;The resulting array is then ordered alphabetically by Location.&lt;BR&gt;We select the details we are interested in - in this case the Person's name and home town, together with the Course's Title and Location. &lt;/P&gt;
&lt;P&gt;(The selection of both HomeTown and Location is of course not really necessary.  I've only done it this way so we can prove that the query has worked correctly by listing both the HomeTown and the Location properties separately in the output.)&lt;/P&gt;
&lt;P&gt; The second block of code which outputs the results of the query to the console is very similar to output code we've used in previous examples. As I mentioned, I've included the place name twice simply to confirm that things are working as they should. The resulting output looks like this:&lt;/P&gt;
&lt;DIV style="MARGIN-LEFT: 10pt; MARGIN-RIGHT: 2pt"&gt;
&lt;DIV style="FONT-SIZE: 12px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'"&gt;Potential Students:&lt;BR&gt;Jan Urqhart From Ghent - Java Course in Ghent&lt;BR&gt;Natalie Hebber From Ghent - Java Course in Ghent&lt;BR&gt;Marc Goosens From Ghent - Java Course in Ghent&lt;BR&gt;Ken Browning From Leeds - VB 2005 Course in Leeds&lt;BR&gt;Ken Browning From Leeds - Classic VB Course in Leeds&lt;BR&gt;William Birchley From Leeds - VB 2005 Course in Leeds&lt;BR&gt;William Birchley From Leeds - Classic VB Course in Leeds&lt;BR&gt;Pauline Pearson From Leeds - VB 2005 Course in Leeds&lt;BR&gt;Pauline Pearson From Leeds - Classic VB Course in Leeds&lt;BR&gt;Sandi Skeet From Manchester - Ajax Course in Manchester&lt;BR&gt;Sylvie Swanson From Manchester - Ajax Course in Manchester&lt;BR&gt;Sarah Wilkinson From Manchester - Ajax Course in Manchester&lt;BR&gt;Frank Whittle From Manchester - Ajax Course in Manchester&lt;BR&gt;Jim Burnley From Manchester - Ajax Course in Manchester&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt; which seems to return the results you would expect, ordered by Location. As noted in a previous Part of this article, a GroupBy operator will also be available at a later stage in the evolution of LINQ in Orcas. &lt;/P&gt;
&lt;P&gt;    Finally, just to make use of that course I created where the start and finish dates have already passed, this query will only pull matches for future courses: &lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #800040 1px solid; BORDER-TOP: #800040 1px solid; MARGIN-LEFT: 10pt; BORDER-LEFT: #800040 1px solid; MARGIN-RIGHT: 2pt; BORDER-BOTTOM: #800040 1px solid"&gt;
&lt;DIV style="FONT-SIZE: 10pt; BORDER-BOTTOM: #800040 1px solid"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy &lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="FONT-SIZE: 15px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'; BACKGROUND-COLOR: #ffffb0"&gt;&lt;FONT color=#0000ff&gt;Private&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Sub&lt;/FONT&gt; FindCurrentCourseMatches()&lt;BR&gt;&lt;FONT color=#0000ff&gt;        Dim&lt;/FONT&gt; Students =&lt;FONT color=#0000ff&gt; From&lt;/FONT&gt; P&lt;FONT color=#0000ff&gt; In&lt;/FONT&gt; People, C&lt;FONT color=#0000ff&gt; In&lt;/FONT&gt; Courses _&lt;BR&gt;&lt;FONT color=#0000ff&gt;         Where&lt;/FONT&gt; P.HomeTown = C.Location _&lt;BR&gt;&lt;FONT color=#0000ff&gt;         Where&lt;/FONT&gt; C.StartDate &gt; DateTime.Today _&lt;BR&gt;&lt;FONT color=#0000ff&gt;         Order&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; By&lt;/FONT&gt; C.Location _&lt;BR&gt;&lt;FONT color=#0000ff&gt;         Select&lt;/FONT&gt; P.Forename, P.Surname, P.HomeTown, C.Title, C.StartDate&lt;BR&gt;&lt;BR&gt;        Console.WriteLine(&lt;FONT color=#a31515&gt;"Potential Students:"&lt;/FONT&gt;)&lt;BR&gt;&lt;FONT color=#0000ff&gt;        For&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Each&lt;/FONT&gt; Potential&lt;FONT color=#0000ff&gt; In&lt;/FONT&gt; Students&lt;BR&gt;&lt;FONT color=#0000ff&gt;            With&lt;/FONT&gt; Potential&lt;BR&gt;                Console.WriteLine(&lt;FONT color=#0000ff&gt;String&lt;/FONT&gt;.Format(&lt;FONT color=#a31515&gt;"{0} {1} From {2} - {3} Course, Starting on {4}"&lt;/FONT&gt;, .Forename, _&lt;BR&gt;                      .Surname, .HomeTown, .Title, .StartDate.ToLongDateString))&lt;BR&gt;&lt;FONT color=#0000ff&gt;            End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; With&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;        Next&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Sub&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;You may have noticed that this time I didn't include the Course Location in the Select line. &lt;BR&gt;The resulting output is:&lt;/P&gt;
&lt;DIV style="MARGIN-LEFT: 10pt; MARGIN-RIGHT: 2pt"&gt;
&lt;DIV style="FONT-SIZE: 12px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'"&gt;Potential Students:&lt;BR&gt;Jan Urqhart From Ghent - Java Course, Starting on 12 December 2007&lt;BR&gt;Natalie Hebber From Ghent - Java Course, Starting on 12 December 2007&lt;BR&gt;Marc Goosens From Ghent - Java Course, Starting on 12 December 2007&lt;BR&gt;Ken Browning From Leeds - VB 2005 Course, Starting on 08 August 2008&lt;BR&gt;William Birchley From Leeds - VB 2005 Course, Starting on 08 August 2008&lt;BR&gt;Pauline Pearson From Leeds - VB 2005 Course, Starting on 08 August 2008&lt;BR&gt;Sandi Skeet From Manchester - Ajax Course, Starting on 13 January 2008&lt;BR&gt;Sylvie Swanson From Manchester - Ajax Course, Starting on 13 January 2008&lt;BR&gt;Sarah Wilkinson From Manchester - Ajax Course, Starting on 13 January 2008&lt;BR&gt;Frank Whittle From Manchester - Ajax Course, Starting on 13 January 2008&lt;BR&gt;Jim Burnley From Manchester - Ajax Course, Starting on 13 January 2008&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;- always assuming that you are reading this before the end of 2007, that is!&lt;/P&gt;
&lt;P&gt;   So, we've scratched the surface of LINQ To Objects and I hope I've succeeded in giving you a flavour of the possibilities.&lt;/P&gt;&lt;/FONT&gt;&lt;img src ="http://blogs.vbcity.com/xtab/aggbug/8293.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Ged Mead</dc:creator><title>Orcas Beta 1 Downloaded and Installed</title><link>http://blogs.vbcity.com/xtab/archive/2007/05/17/8290.aspx</link><pubDate>Thu, 17 May 2007 14:47:00 GMT</pubDate><guid>http://blogs.vbcity.com/xtab/archive/2007/05/17/8290.aspx</guid><description>&lt;P&gt;   &lt;FONT face=Verdana size=2&gt;Thanks to my VBCity colleague, Scott Waletzko a.k.a. Sp!ke, I'm now happily sat here with the Orcas Beta 1 fully installed and running smoothly.   I'd suffered more than my fair share of pain when installing the March 2007 CTP so I was a bit concerned that the Beta would be a re-run of that.     The VPC version had been a particular nightmare but I did get a more or less working version up and running eventually.      After that, apart from a couple of minor glitches -  all efforts to view the Property pages gave me an error and I didn't have access to the offline MSDN -  it has worked well and I've been able to do quite a lot of research in general and testing out various elements of LINQ in particular.&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;   I've also made a tentative start on XAML and WPF, but can see right away that it's going to be a tough uphill slog.    I reckon the learning curve of WPF is going to be just as steep as the one from Classic VB to VB.NET.   Ah well, no pain, no gain, as they say.&lt;/FONT&gt;   &lt;FONT face=Verdana size=2&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;    I really hope there are some VB authors out there who are already planning to write WPF books using VB as the code behind.   Almost every book I can find at the moment only has C# as the code behind language.   It's hard enough getting your head round the XAML without having to translate fron C# to VB on the fly too.    Luckily there are some useful examples using VB in the MSDN pages, so I'm working through those while waiting for the first VB oriented book to appear on the bookstalls.  (If anyone knows of any, whether available now or planned, please post up details as a comment.)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;   Having spent several days (I exaggerate not) sweating over the March CTP installation, I was in a bit of trepidation about what kind of experience the Beta 1 installation would give me.  I needn't have worried.   I carefully uninstalled all previous Orcas and related installations, keeping strictly to the uninstall order in the ReadMe.   It took a while and a couple of reboots.  Then, fingers crossed, I started the install of Beta 1.   Smooth as silk!   I went for the default installation option and all went well.   MSDN installation next and this too was totally problem/warning message/blue screen free!&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;   So, after maybe a total of 3 - 4 hours, it's all running well.   I also got hold of the Beta 1 LINQ samples, which are of course very similar to the March CTP ones.  Setting up LINQ to SQL having given me a problem in the CTP stage, so I was pleased to see that the comments and instructions in the latest LINQ Samples download made more sense (at least to me!) and I was able to get them running this time.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;   The download version I used came from &lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyID=5d9c6b2d-439c-4ec2-8e24-b7d9ff6a2ab2&amp;DisplayLang=en"&gt;here&lt;/A&gt; The Pro Edition Self-Extracting Install.  I'm told that it runs almost without problem side by side with VS 2005, but I'm still playing safe and keeping it in quarantine on a spare machine.  All the VB 2005 projects that I have tried running inside Orcas have run without problem (as they should of course, because Orcas boasts multi-targetting of Framework versions 2, 3 and 3.5).    &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;   The Beta 1 LINQ samples for VB can be downloaded from &lt;A href="http://msdn2.microsoft.com/en-us/bb330936.aspx"&gt;here.&lt;/A&gt;   Speaking of LINQ, I'm hoping to get the third part of my LINQ To Objects article finished by the weekend, before moving on to exploring other areas of LINQ .&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;&lt;/FONT&gt; &lt;/P&gt;&lt;/FONT&gt;&lt;img src ="http://blogs.vbcity.com/xtab/aggbug/8290.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Ged Mead</dc:creator><title>LINQ To Objects - Part 2</title><link>http://blogs.vbcity.com/xtab/archive/2007/05/10/8278.aspx</link><pubDate>Thu, 10 May 2007 14:44:00 GMT</pubDate><guid>http://blogs.vbcity.com/xtab/archive/2007/05/10/8278.aspx</guid><description>&lt;P&gt;&lt;U&gt;&lt;FONT face=Verdana color=#800080 size=2&gt;Let's Run Some Queries!&lt;/FONT&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana color=#800080 size=2&gt;   &lt;FONT color=#000000&gt;By the end of &lt;A href="http://blogs.vbcity.com/xtab/archive/2007/04/29/8261.aspx"&gt;Part 1 &lt;/A&gt;we set the stage and looked at a couple of new features coming up in Orcas, but hadn't done anything particularly exciting and new with LINQ To Objects.   In this Part I'll hopefully whet your appetite for LINQ a little bit more as we run some queries that are (a) very easy with LINQ and (b) nowhere near as easy with VB 2005 and earlier edition tools.  (And later in Part 3 you'll &lt;EM&gt;really &lt;/EM&gt;be able to see the future according to LINQ!)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;   Let's begin with a query that finds all the Person objects in our Person List who are under 21 and who live in Belgium.   The LINQ version of such a query is:&lt;/FONT&gt;&lt;FONT face=Verdana size=2&gt;   &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;  &lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #800040 1px solid; BORDER-TOP: #800040 1px solid; MARGIN-LEFT: 10pt; BORDER-LEFT: #800040 1px solid; MARGIN-RIGHT: 2pt; BORDER-BOTTOM: #800040 1px solid"&gt;
&lt;DIV style="FONT-SIZE: 10pt; BORDER-BOTTOM: #800040 1px solid" onclick="var i=this.sel,j;if(i==this.selold)return;var sh=new Array('none',''),o=this.parentNode;j=i==0?0:1;this.selold=i;o.childNodes[1].style.display=sh[j];o.childNodes[2].style.display=sh[1-j];o=o.childNodes[1];var h =o.offsetHeight;o.style.height=i==1?'150pt':'';if(i==1 &amp;&amp; o.offsetHeight&gt;h)o.style.height=h;" selold="2" sel="2"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy &lt;/A&gt;&lt;INPUT onclick=parentNode.sel=0 type=button value=Hide&gt;&lt;INPUT onclick=parentNode.sel=1 type=button value=Scroll&gt;&lt;INPUT onclick=parentNode.sel=2 type=button value=Full&gt;&lt;/DIV&gt;
&lt;DIV style="FONT-SIZE: 15px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'; BACKGROUND-COLOR: #ffffb7"&gt;&lt;FONT color=#0000ff&gt;  Dim&lt;/FONT&gt; People()&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt; Person&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;  Private&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Sub&lt;/FONT&gt; Button1_Click(&lt;FONT color=#0000ff&gt;ByVal&lt;/FONT&gt; sender&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt; System.Object,&lt;FONT color=#0000ff&gt; ByVal&lt;/FONT&gt; e&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt; System.EventArgs) _&lt;BR&gt;&lt;FONT color=#0000ff&gt;  Handles&lt;/FONT&gt; Button1.Click&lt;BR&gt;&lt;FONT color=#0000ff&gt;    Dim&lt;/FONT&gt; YoungBelgians =&lt;FONT color=#0000ff&gt; From&lt;/FONT&gt; P&lt;FONT color=#0000ff&gt; In&lt;/FONT&gt; People _&lt;BR&gt;&lt;FONT color=#0000ff&gt;       Where&lt;/FONT&gt; P.DateOfBirth &gt; #12/12/1978#&lt;FONT color=#0000ff&gt; AndAlso&lt;/FONT&gt; P.Country =&lt;FONT color=#a31515&gt; "Belgium"&lt;/FONT&gt; _&lt;BR&gt;&lt;FONT color=#0000ff&gt;       Select&lt;/FONT&gt; p&lt;BR&gt;&lt;BR&gt;    Console.WriteLine(&lt;FONT color=#a31515&gt;"Young Belgians:"&lt;/FONT&gt;)&lt;BR&gt;&lt;FONT color=#0000ff&gt;      For&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Each&lt;/FONT&gt; Youth&lt;FONT color=#0000ff&gt; In&lt;/FONT&gt; YoungBelgians&lt;BR&gt;          Console.WriteLine(Youth.Forename &amp;&lt;FONT color=#a31515&gt; " "&lt;/FONT&gt; &amp; Youth.Surname)&lt;BR&gt;&lt;FONT color=#0000ff&gt;      Next&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Sub&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV style="DISPLAY: none; BACKGROUND-COLOR: #ffffb7"&gt;&lt;B&gt;. . .&lt;/B&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;BR&gt;&lt;FONT face=Verdana color=#000000 size=2&gt;In the above example (and those that follow) I used a small collection of pre-created Person objects. If you want the code for this in order to try the queries yourself, it looks like this:&lt;/FONT&gt; &lt;BR&gt;&lt;BR&gt;
&lt;DIV style="BORDER-RIGHT: #800040 1px solid; BORDER-TOP: #800040 1px solid; MARGIN-LEFT: 10pt; BORDER-LEFT: #800040 1px solid; MARGIN-RIGHT: 2pt; BORDER-BOTTOM: #800040 1px solid"&gt;
&lt;DIV style="FONT-SIZE: 10pt; BORDER-BOTTOM: #800040 1px solid" onclick="var i=this.sel,j;if(i==this.selold)return;var sh=new Array('none',''),o=this.parentNode;j=i==0?0:1;this.selold=i;o.childNodes[1].style.display=sh[j];o.childNodes[2].style.display=sh[1-j];o=o.childNodes[1];var h =o.offsetHeight;o.style.height=i==1?'150pt':'';if(i==1 &amp;&amp; o.offsetHeight&gt;h)o.style.height=h;" selold="1" sel="1"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy &lt;/A&gt;&lt;INPUT onclick=parentNode.sel=0 type=button value=Hide&gt;&lt;INPUT onclick=parentNode.sel=1 type=button value=Scroll&gt;&lt;INPUT onclick=parentNode.sel=2 type=button value=Full&gt;&lt;/DIV&gt;
&lt;DIV style="FONT-SIZE: 15px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'; HEIGHT: 150px; BACKGROUND-COLOR: #ffffb7"&gt;&lt;FONT color=#0000ff&gt;  Function&lt;/FONT&gt; CreateDataVB9_3()&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt; Array&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;      Dim&lt;/FONT&gt; SomePeople()&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt; Person = {&lt;FONT color=#0000ff&gt;New&lt;/FONT&gt; Person&lt;FONT color=#0000ff&gt; With&lt;/FONT&gt; {.Forename =&lt;FONT color=#a31515&gt; "Jan"&lt;/FONT&gt;, .Surname =&lt;FONT color=#a31515&gt; "Urqhart"&lt;/FONT&gt;, _&lt;BR&gt;                   .DateOfBirth = #9/8/1959#, .Gender = Gender.Female, _&lt;BR&gt;                   .Country =&lt;FONT color=#a31515&gt; "Belgium"&lt;/FONT&gt;, .HomeTown =&lt;FONT color=#a31515&gt; "Ghent"&lt;/FONT&gt;}, _&lt;BR&gt;&lt;FONT color=#0000ff&gt;           New&lt;/FONT&gt; Person&lt;FONT color=#0000ff&gt; With&lt;/FONT&gt; {.Surname =&lt;FONT color=#a31515&gt; "Fleischmann"&lt;/FONT&gt;, .Forename =&lt;FONT color=#a31515&gt; "Heinje"&lt;/FONT&gt;, .Country =&lt;FONT color=#a31515&gt; "Belgium"&lt;/FONT&gt;, _&lt;BR&gt;                   .Gender = Gender.Male, .DateOfBirth = #7/11/1982#, .HomeTown =&lt;FONT color=#a31515&gt; "Mons"&lt;/FONT&gt;}, _&lt;BR&gt;&lt;FONT color=#0000ff&gt;           New&lt;/FONT&gt; Person&lt;FONT color=#0000ff&gt; With&lt;/FONT&gt; {.HomeTown =&lt;FONT color=#a31515&gt; "Leeds"&lt;/FONT&gt;, .Forename =&lt;FONT color=#a31515&gt; "Ken"&lt;/FONT&gt;, .Surname =&lt;FONT color=#a31515&gt; "Browning"&lt;/FONT&gt;, _&lt;BR&gt;                   .Gender = Gender.Male, .DateOfBirth = #3/9/1978#}, _&lt;BR&gt;&lt;FONT color=#0000ff&gt;           New&lt;/FONT&gt; Person&lt;FONT color=#0000ff&gt; With&lt;/FONT&gt; {.Forename =&lt;FONT color=#a31515&gt; "Sandi"&lt;/FONT&gt;, .Surname =&lt;FONT color=#a31515&gt; "Skeet"&lt;/FONT&gt;, .DateOfBirth = #4/9/1981#, _&lt;BR&gt;                   .Gender = Gender.Female, .Country =&lt;FONT color=#a31515&gt; "UK"&lt;/FONT&gt;, .HomeTown =&lt;FONT color=#a31515&gt; "Manchester"&lt;/FONT&gt;}, _&lt;BR&gt;&lt;FONT color=#0000ff&gt;           New&lt;/FONT&gt; Person&lt;FONT color=#0000ff&gt; With&lt;/FONT&gt; {.Forename =&lt;FONT color=#a31515&gt; "Janet"&lt;/FONT&gt;, .Surname =&lt;FONT color=#a31515&gt; "Brent"&lt;/FONT&gt;, _&lt;BR&gt;                    .DateOfBirth = #9/12/1969#, .Gender = Gender.Female, _&lt;BR&gt;                    .Country =&lt;FONT color=#a31515&gt; "Belgium"&lt;/FONT&gt;, .HomeTown =&lt;FONT color=#a31515&gt; "Antwerp"&lt;/FONT&gt;}, _&lt;BR&gt;&lt;FONT color=#0000ff&gt;           New&lt;/FONT&gt; Person&lt;FONT color=#0000ff&gt; With&lt;/FONT&gt; {.Forename =&lt;FONT color=#a31515&gt; "Ged"&lt;/FONT&gt;, .Surname =&lt;FONT color=#a31515&gt; "Mead"&lt;/FONT&gt;, .DateOfBirth = #11/24/1946#, _&lt;BR&gt;                    .HomeTown =&lt;FONT color=#a31515&gt; "Dumfries"&lt;/FONT&gt;, .Country =&lt;FONT color=#a31515&gt; "UK"&lt;/FONT&gt;}, _&lt;BR&gt;&lt;FONT color=#0000ff&gt;           New&lt;/FONT&gt; Person&lt;FONT color=#0000ff&gt; With&lt;/FONT&gt; {.Forename =&lt;FONT color=#a31515&gt; "Sylvie"&lt;/FONT&gt;, .Surname =&lt;FONT color=#a31515&gt; "Swanson"&lt;/FONT&gt;, _&lt;BR&gt;                    .DateOfBirth = #12/1/1977#, .Gender = Gender.Female, _&lt;BR&gt;                    .Country =&lt;FONT color=#a31515&gt; "UK"&lt;/FONT&gt;, .HomeTown =&lt;FONT color=#a31515&gt; "Manchester"&lt;/FONT&gt;}, _&lt;BR&gt;&lt;FONT color=#0000ff&gt;           New&lt;/FONT&gt; Person&lt;FONT color=#0000ff&gt; With&lt;/FONT&gt; {.Forename =&lt;FONT color=#a31515&gt; "Freddie"&lt;/FONT&gt;, .Surname =&lt;FONT color=#a31515&gt; "Foggin"&lt;/FONT&gt;, .DateOfBirth = #4/14/1958#, _&lt;BR&gt;                    .HomeTown =&lt;FONT color=#a31515&gt; "York"&lt;/FONT&gt;, .Country =&lt;FONT color=#a31515&gt; "UK"&lt;/FONT&gt;}, _&lt;BR&gt;&lt;FONT color=#0000ff&gt;           New&lt;/FONT&gt; Person&lt;FONT color=#0000ff&gt; With&lt;/FONT&gt; {.Forename =&lt;FONT color=#a31515&gt; "Johannes"&lt;/FONT&gt;, .Surname =&lt;FONT color=#a31515&gt; "LeBon"&lt;/FONT&gt;, _&lt;BR&gt;                    .DateOfBirth = #10/8/1978#, .Gender = Gender.Male, _&lt;BR&gt;                    .Country =&lt;FONT color=#a31515&gt; "Belgium"&lt;/FONT&gt;, .HomeTown =&lt;FONT color=#a31515&gt; "Aachen"&lt;/FONT&gt;}, _&lt;BR&gt;&lt;FONT color=#0000ff&gt;           New&lt;/FONT&gt; Person&lt;FONT color=#0000ff&gt; With&lt;/FONT&gt; {.Forename =&lt;FONT color=#a31515&gt; "William"&lt;/FONT&gt;, .Surname =&lt;FONT color=#a31515&gt; "Birchley"&lt;/FONT&gt;, _&lt;BR&gt;                    .DateOfBirth = #7/8/1959#, .Gender = Gender.Male, _&lt;BR&gt;                    .Country =&lt;FONT color=#a31515&gt; "UK"&lt;/FONT&gt;, .HomeTown =&lt;FONT color=#a31515&gt; "Leeds"&lt;/FONT&gt;}, _&lt;BR&gt;&lt;FONT color=#0000ff&gt;           New&lt;/FONT&gt; Person&lt;FONT color=#0000ff&gt; With&lt;/FONT&gt; {.Forename =&lt;FONT color=#a31515&gt; "Sarah"&lt;/FONT&gt;, .Surname =&lt;FONT color=#a31515&gt; "Wilkinson"&lt;/FONT&gt;, _&lt;BR&gt;                    .DateOfBirth = #10/18/1990#, .Gender = Gender.Female, _&lt;BR&gt;                    .Country =&lt;FONT color=#a31515&gt; "UK"&lt;/FONT&gt;, .HomeTown =&lt;FONT color=#a31515&gt; "Manchester"&lt;/FONT&gt;}, _&lt;BR&gt;&lt;FONT color=#0000ff&gt;           New&lt;/FONT&gt; Person&lt;FONT color=#0000ff&gt; With&lt;/FONT&gt; {.Forename =&lt;FONT color=#a31515&gt; "Frank"&lt;/FONT&gt;, .Surname =&lt;FONT color=#a31515&gt; "Whittle"&lt;/FONT&gt;, _&lt;BR&gt;                    .DateOfBirth = #1/8/1993#, .Gender = Gender.Male, _&lt;BR&gt;                    .Country =&lt;FONT color=#a31515&gt; "UK"&lt;/FONT&gt;, .HomeTown =&lt;FONT color=#a31515&gt; "Manchester"&lt;/FONT&gt;}, _&lt;BR&gt;&lt;FONT color=#0000ff&gt;           New&lt;/FONT&gt; Person&lt;FONT color=#0000ff&gt; With&lt;/FONT&gt; {.Forename =&lt;FONT color=#a31515&gt; "Natalie"&lt;/FONT&gt;, .Surname =&lt;FONT color=#a31515&gt; "Hebber"&lt;/FONT&gt;, _&lt;BR&gt;                    .DateOfBirth = #2/28/1986#, .Gender = Gender.Female, _&lt;BR&gt;                    .Country =&lt;FONT color=#a31515&gt; "Belgium"&lt;/FONT&gt;, .HomeTown =&lt;FONT color=#a31515&gt; "Ghent"&lt;/FONT&gt;}, _&lt;BR&gt;&lt;FONT color=#0000ff&gt;           New&lt;/FONT&gt; Person&lt;FONT color=#0000ff&gt; With&lt;/FONT&gt; {.Forename =&lt;FONT color=#a31515&gt; "Franc"&lt;/FONT&gt;, .Surname =&lt;FONT color=#a31515&gt; "Mendler"&lt;/FONT&gt;, _&lt;BR&gt;                     .DateOfBirth = #10/8/1990#, .Gender = Gender.Male, _&lt;BR&gt;                     .Country =&lt;FONT color=#a31515&gt; "Belgium"&lt;/FONT&gt;, .HomeTown =&lt;FONT color=#a31515&gt; "Aachen"&lt;/FONT&gt;}, _&lt;FONT color=#0000ff&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;     New&lt;/FONT&gt; Person&lt;FONT color=#0000ff&gt; With&lt;/FONT&gt; {.Forename =&lt;FONT color=#a31515&gt; "Marc"&lt;/FONT&gt;, .Surname =&lt;FONT color=#a31515&gt; "Goosens"&lt;/FONT&gt;, _&lt;/DIV&gt;                     .DateOfBirth = #9/9/1989#, .Gender = Gender.Male, _&lt;BR&gt;                     .Country =&lt;FONT color=#a31515&gt; "Belgium"&lt;/FONT&gt;, .HomeTown =&lt;FONT color=#a31515&gt; "Ghent"&lt;/FONT&gt;}, _&lt;FONT color=#0000ff&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;     New&lt;/FONT&gt; Person&lt;FONT color=#0000ff&gt; With&lt;/FONT&gt; {.Forename =&lt;FONT color=#a31515&gt; "Pauline"&lt;/FONT&gt;, .Surname =&lt;FONT color=#a31515&gt; "Pearson"&lt;/FONT&gt;, .DateOfBirth = #12/19/1989#, _&lt;/DIV&gt;                     .Gender = Gender.Female, .Country =&lt;FONT color=#a31515&gt; "UK"&lt;/FONT&gt;, .HomeTown =&lt;FONT color=#a31515&gt; "Leeds"&lt;/FONT&gt;}, _&lt;FONT color=#0000ff&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;     New&lt;/FONT&gt; Person&lt;FONT color=#0000ff&gt; With&lt;/FONT&gt; {.Forename =&lt;FONT color=#a31515&gt; "Jim"&lt;/FONT&gt;, .Surname =&lt;FONT color=#a31515&gt; "Burnley"&lt;/FONT&gt;, .DateOfBirth = #1/29/1981#, _&lt;/DIV&gt;                     .Gender = Gender.Male, .Country =&lt;FONT color=#a31515&gt; "UK"&lt;/FONT&gt;, .HomeTown =&lt;FONT color=#a31515&gt; "Manchester"&lt;/FONT&gt;}}&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;        Return&lt;/FONT&gt; SomePeople&lt;BR&gt;&lt;FONT color=#0000ff&gt;    End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Function&lt;/FONT&gt;&lt;BR&gt;&lt;/DIV&gt;
&lt;DIV style="DISPLAY: none; BACKGROUND-COLOR: #ffffb7"&gt;&lt;B&gt;. . .&lt;/B&gt;&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;And to populate the People array with that data, you would just call it with:&lt;/FONT&gt; &lt;BR&gt;&lt;BR&gt;&lt;FONT face="Courier New" size=2 ,&gt;     People = CreateDataVB9_3()&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt; &lt;FONT face=Verdana&gt; If you have read the first part of this article, you will know that the above code uses some of the new features that will be available in VB 9, in particular the extended use of the &lt;EM&gt;With&lt;/EM&gt; keyword and a new style of array initialization.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;BR&gt;&lt;FONT face=Verdana size=2&gt;
&lt;P&gt;Taking this query a step further, it is very easy to sort the list of Young Belgians alphabetically by surname: &lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #800040 1px solid; BORDER-TOP: #800040 1px solid; MARGIN-LEFT: 10pt; BORDER-LEFT: #800040 1px solid; MARGIN-RIGHT: 2pt; BORDER-BOTTOM: #800040 1px solid"&gt;
&lt;DIV style="FONT-SIZE: 10pt; BORDER-BOTTOM: #800040 1px solid"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy &lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="FONT-SIZE: 15px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'; BACKGROUND-COLOR: #ffffb7"&gt;&lt;FONT color=#0000ff&gt;       Dim&lt;/FONT&gt; YoungBelgians =&lt;FONT color=#0000ff&gt; From&lt;/FONT&gt; P&lt;FONT color=#0000ff&gt; In&lt;/FONT&gt; People _&lt;BR&gt;&lt;FONT color=#0000ff&gt;          Where&lt;/FONT&gt; P.DateOfBirth &gt; #12/12/1978#&lt;FONT color=#0000ff&gt; AndAlso&lt;/FONT&gt; P.Country =&lt;FONT color=#a31515&gt; "Belgium"&lt;/FONT&gt; _&lt;BR&gt;&lt;FONT color=#0000ff&gt;          Order&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; By&lt;/FONT&gt; P.Surname _&lt;BR&gt;&lt;FONT color=#0000ff&gt;          Select&lt;/FONT&gt; p&lt;BR&gt;&lt;BR&gt;        Console.WriteLine(&lt;FONT color=#a31515&gt;"Young Belgians:"&lt;/FONT&gt;)&lt;BR&gt;&lt;FONT color=#0000ff&gt;        For&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Each&lt;/FONT&gt; Youth&lt;FONT color=#0000ff&gt; In&lt;/FONT&gt; YoungBelgians&lt;BR&gt;            Console.WriteLine(Youth.Surname &amp;&lt;FONT color=#a31515&gt; ", "&lt;/FONT&gt; &amp; Youth.Forename)&lt;BR&gt;&lt;FONT color=#0000ff&gt;        Next&lt;/FONT&gt;&lt;BR&gt;&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;The resulting display will be: &lt;BR&gt;&lt;BR&gt;&lt;FONT face="Courier New"&gt;Young Belgians: &lt;BR&gt;Fleischmann, Heinje &lt;BR&gt;Goosens, Marc &lt;BR&gt;Hebber, Natalie &lt;BR&gt;Mendler, Franc&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;By the way, here's a little Gotcha that's worth watching out for: If you try the code out and you see the following error:-&lt;BR&gt;&lt;BR&gt;&lt;FONT face="Courier New" color=red size=2&gt;   'Select Case' must end with a matching 'End Select'&lt;/FONT&gt; &lt;/P&gt;this will be because you forgot to add the underscore at the end of the previous line. Been there, done that! &lt;BR&gt;&lt;BR&gt;
&lt;HR&gt;

&lt;P&gt;With LINQ you can sort and sub-sort all on one line. This time we will return all Persons and sort them first by Gender and then by Surnames within each Gender. The LINQ code is trivial: &lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #800040 1px solid; BORDER-TOP: #800040 1px solid; MARGIN-LEFT: 10pt; BORDER-LEFT: #800040 1px solid; MARGIN-RIGHT: 2pt; BORDER-BOTTOM: #800040 1px solid"&gt;
&lt;DIV style="FONT-SIZE: 10pt; BORDER-BOTTOM: #800040 1px solid"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy &lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="FONT-SIZE: 15px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'; BACKGROUND-COLOR: #ffffb7"&gt;&lt;FONT color=#0000ff&gt;    Dim&lt;/FONT&gt; AllPersons =&lt;FONT color=#0000ff&gt; From&lt;/FONT&gt; P&lt;FONT color=#0000ff&gt; In&lt;/FONT&gt; People _&lt;BR&gt;&lt;FONT color=#0000ff&gt;           Order&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; By&lt;/FONT&gt; P.Gender, P.Surname _&lt;BR&gt;&lt;FONT color=#0000ff&gt;           Select&lt;/FONT&gt; P&lt;BR&gt;&lt;BR&gt;    Console.WriteLine(&lt;FONT color=#a31515&gt;"All Persons (Sorted):"&lt;/FONT&gt;)&lt;BR&gt;&lt;FONT color=#0000ff&gt;        For&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Each&lt;/FONT&gt; SortedPerson&lt;FONT color=#0000ff&gt; In&lt;/FONT&gt; AllPersons&lt;BR&gt;            Console.WriteLine(SortedPerson.Forename &amp;&lt;FONT color=#a31515&gt; " "&lt;/FONT&gt; &amp; SortedPerson.Surname)&lt;BR&gt;&lt;FONT color=#0000ff&gt;        Next&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;The output from this looks like this: &lt;BR&gt;&lt;BR&gt;&lt;FONT face="Courier New" size=2&gt;All Persons (Sorted): &lt;BR&gt;Janet Brent &lt;BR&gt;Natalie Hebber&lt;BR&gt;Pauline Pearson&lt;BR&gt;Sandi Skeet&lt;BR&gt;Sylvie Swanson&lt;BR&gt;Jan Urqhart&lt;BR&gt;Sarah Wilkinson&lt;BR&gt;William Birchley&lt;BR&gt;Ken Browning&lt;BR&gt;Jim Burnley&lt;BR&gt;Heinje Fleischmann&lt;BR&gt;Marc Goosens&lt;BR&gt;Johannes LeBon&lt;BR&gt;Franc Mendler&lt;BR&gt;Frank Whittle&lt;BR&gt;Freddie Foggin&lt;BR&gt;Ged Mead&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;  The output is correct. First the Females(7), then the Males(8) and finally those that weren't assigned a value for Gender when the collection was created(2). But it's not particularly well formatted, is it? What would be good would be to group them, each with their Gender Heading. This will be possible using the "Group By" operator. Unfortunately at the time of writing this feature isn't implemented in VB, but I'll revisit this item and update it when it is - either via a later Beta or the final version when it is released. &lt;/P&gt;
&lt;P&gt;For now, I'll settle for:&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #800040 1px solid; BORDER-TOP: #800040 1px solid; MARGIN-LEFT: 10pt; BORDER-LEFT: #800040 1px solid; MARGIN-RIGHT: 2pt; BORDER-BOTTOM: #800040 1px solid"&gt;
&lt;DIV style="FONT-SIZE: 10pt; BORDER-BOTTOM: #800040 1px solid"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy &lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="FONT-SIZE: 15px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'; BACKGROUND-COLOR: #ffffb7"&gt;&lt;FONT color=#0000ff&gt;        Dim&lt;/FONT&gt; AllPersons =&lt;FONT color=#0000ff&gt; From&lt;/FONT&gt; P&lt;FONT color=#0000ff&gt; In&lt;/FONT&gt; People _&lt;BR&gt;&lt;FONT color=#0000ff&gt;             Order&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; By&lt;/FONT&gt; P.Gender, P.Surname _&lt;BR&gt;&lt;FONT color=#0000ff&gt;             Select&lt;/FONT&gt; P&lt;BR&gt;&lt;BR&gt;        Console.WriteLine(&lt;FONT color=#a31515&gt;"All Persons (Sorted):"&lt;/FONT&gt;)&lt;BR&gt;&lt;FONT color=#0000ff&gt;        For&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Each&lt;/FONT&gt; SortedPerson&lt;FONT color=#0000ff&gt; In&lt;/FONT&gt; AllPersons&lt;BR&gt;            Console.WriteLine(SortedPerson.Forename &amp;&lt;FONT color=#a31515&gt; " "&lt;/FONT&gt; &amp; _&lt;BR&gt;                SortedPerson.Surname &amp;&lt;FONT color=#a31515&gt; " : "&lt;/FONT&gt; &amp; SortedPerson.Gender.ToString)&lt;BR&gt;&lt;FONT color=#0000ff&gt;        Next&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;which does make things clearer, even if it's not ideal.&lt;/P&gt;
&lt;HR&gt;

&lt;P&gt;It's also easy to have multiple Where operators in the same query. Take a case where you wanted to identify &lt;EM&gt;all&lt;/EM&gt; those over 21 who live in &lt;EM&gt;either&lt;/EM&gt; Leeds or Ghent. The query would be:&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #800040 1px solid; BORDER-TOP: #800040 1px solid; MARGIN-LEFT: 10pt; BORDER-LEFT: #800040 1px solid; MARGIN-RIGHT: 2pt; BORDER-BOTTOM: #800040 1px solid"&gt;
&lt;DIV style="FONT-SIZE: 10pt; BORDER-BOTTOM: #800040 1px solid"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy &lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="FONT-SIZE: 15px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'; BACKGROUND-COLOR: #ffffb7"&gt;&lt;FONT color=#0000ff&gt;Dim&lt;/FONT&gt; AllPersons =&lt;FONT color=#0000ff&gt; From&lt;/FONT&gt; P&lt;FONT color=#0000ff&gt; In&lt;/FONT&gt; People _&lt;BR&gt;&lt;FONT color=#0000ff&gt;      Where&lt;/FONT&gt; P.HomeTown =&lt;FONT color=#a31515&gt; "Leeds"&lt;/FONT&gt; _&lt;BR&gt;&lt;FONT color=#0000ff&gt;         Or&lt;/FONT&gt; P.HomeTown =&lt;FONT color=#a31515&gt; "Ghent"&lt;/FONT&gt; _&lt;BR&gt;&lt;FONT color=#0000ff&gt;      Where&lt;/FONT&gt; P.DateOfBirth &lt; #1/1/1987# _&lt;BR&gt;&lt;FONT color=#0000ff&gt;         Order&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; By&lt;/FONT&gt; P.DateOfBirth&lt;FONT color=#0000ff&gt; Descending&lt;/FONT&gt; _&lt;BR&gt;&lt;FONT color=#0000ff&gt;Select&lt;/FONT&gt; P&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;   Notice also that this query sorts the names in date of birth descending order so the youngest person will be listed first, which is more intuitive. The following code snippet displays the result to the console. (The CalculateAge method isn't relevant to the LINQ query as such, but as it is available in the Person Class created earlier I've used it to improve the output for the user.)&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #800040 1px solid; BORDER-TOP: #800040 1px solid; MARGIN-LEFT: 10pt; BORDER-LEFT: #800040 1px solid; MARGIN-RIGHT: 2pt; BORDER-BOTTOM: #800040 1px solid"&gt;
&lt;DIV style="FONT-SIZE: 10pt; BORDER-BOTTOM: #800040 1px solid"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy &lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="FONT-SIZE: 15px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'; BACKGROUND-COLOR: #ffffb7"&gt;  Console.WriteLine(&lt;FONT color=#a31515&gt;"All Persons (Over 21 From Leeds and Ghent):"&lt;/FONT&gt;)&lt;BR&gt;&lt;FONT color=#0000ff&gt;     For&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Each&lt;/FONT&gt; TwinTownPerson&lt;FONT color=#0000ff&gt; In&lt;/FONT&gt; AllPersons&lt;BR&gt;        Console.WriteLine(TwinTownPerson.Forename &amp;&lt;FONT color=#a31515&gt; " "&lt;/FONT&gt; &amp; _&lt;BR&gt;            TwinTownPerson.Surname &amp;&lt;FONT color=#a31515&gt; " : "&lt;/FONT&gt; &amp;&lt;FONT color=#0000ff&gt; CStr&lt;/FONT&gt;(Person.CalculateAge(TwinTownPerson.DateOfBirth, Now)) &amp;&lt;FONT color=#a31515&gt; "  -  "&lt;/FONT&gt; &amp; TwinTownPerson.HomeTown)&lt;BR&gt;&lt;FONT color=#0000ff&gt;     Next&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;The output is:- &lt;BR&gt;&lt;FONT face="Courier New" size=2&gt;All Persons (Over 21 From Leeds and Ghent): &lt;BR&gt;Natalie Hebber : 21 - Ghent &lt;BR&gt;Ken Browning : 29 - Leeds&lt;BR&gt;Jan Urqhart : 47 - Ghent&lt;BR&gt;William Birchley : 47 - Leeds&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;  Several of the more interesting operators are still not implemented at the time of writing. &lt;I&gt;Group By&lt;/I&gt;, as mentioned earlier and also &lt;I&gt;Join&lt;/I&gt;, which obviously is going to be a very powerful tool in LINQ queries. I have also seen samples which appear to use &lt;I&gt;Into&lt;/I&gt;, but I haven't been able to implement that either in my March CTP version. &lt;/P&gt;
&lt;P&gt;  I plan to include samples that will demonstrate all of these and more as they come onstream. In the meantime, the next and (for the time being) final part of LINQ To Objects we will look at how to join two data sources and run a query against them. &lt;/P&gt;&lt;/FONT&gt;&lt;img src ="http://blogs.vbcity.com/xtab/aggbug/8278.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Ged Mead</dc:creator><title>LINQ To Objects : Part 1</title><link>http://blogs.vbcity.com/xtab/archive/2007/04/29/8261.aspx</link><pubDate>Sun, 29 Apr 2007 17:06:00 GMT</pubDate><guid>http://blogs.vbcity.com/xtab/archive/2007/04/29/8261.aspx</guid><description>&lt;P&gt;   &lt;FONT face=Verdana size=2&gt;There's no doubt that LINQ is one of the headline features of Visual Studio Orcas.   I've been trying out some LINQ queries; it's a very interesting new area with massive potential.   It seems though that most books and articles available at the moment are C# based, so I thought I'd blog my journey through the Land of LINQ in case any other VB DotNetters might find it useful now or in the future.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;   I'm currently using The March CTP of Orcas for the samples I will demonstrate in these blogs.  If you want to dip into LINQ but don't want to install the CTP or the Betas as they come on stream, you can get limited access to LINQ features in VB 2005 via the .NET LINQ Tech Preview (May 2006) .&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;&lt;U&gt;&lt;FONT color=#800000&gt;The 10 Second Version of "What is LINQ?"&lt;/FONT&gt;&lt;/U&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana color=#800000 size=2&gt;  &lt;FONT color=#000000&gt; I've seen answers to that question that run to several pages.  Hopefully by the end of this series of articles, you will have formed your own opinion, but to get us started, here's the 10 second version.  &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana color=#000000 size=2&gt;   LINQ is a tool that will enable you to use the same coding techniques to run queries against a wide range of types of data storage - e.g. simple arrays,  collections of complex objects, XML and relational databases.    It looks a lot like SQL, but isn't actually SQL.  Many of the queries you can run against collections will be far less verbose than the hoops (and loops!) you would have to jump through to get the same results without LINQ. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;   For now, this is enough information.   We will of course have to look into the whys and hows of LINQ as we dig deeper into the topic.&lt;/FONT&gt;&lt;FONT face=Verdana size=2&gt;    &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;&lt;U&gt;&lt;FONT color=#800000&gt;Some Data To Work With&lt;/FONT&gt; &lt;/U&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;BR&gt;   &lt;FONT face=Verdana size=2&gt;The kind of data that is most appropriate for LINQ To Objects demos is something fairly basic but which still has enough content to be useful for the range of queries I plan to demonstrate. I wanted to stay away from the Products type of data because I want to use that in the LINQ to SQL article (probably utilising Northwind).   So in the end I decided on an old favourite for demos - the Person class.   This  Class has a couple of constructors and six Properties - Forename, Surname, DateOfBirth, Gender, HomeTown and Country.   &lt;/FONT&gt;&lt;FONT face=Verdana size=2&gt;   If you want to see the code for this class, it is available &lt;A href="http://www.xtabvbcity.plus.com/Articles/VB9Article1/VB9Article_1_Page1.htm"&gt;here.&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;   Before we look at the first LINQ queries, I want to briefly run through some of the ways we create instances of objects (in this case Person instances) and, more importantly, how to create collections of those instances.&lt;/FONT&gt;&lt;/P&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;U&gt;&lt;FONT face=Verdana&gt;&lt;FONT color=#800000&gt;Creating Instances Of Complex Objects&lt;/FONT&gt; &lt;/FONT&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;  &lt;FONT face=Verdana size=2&gt; In VB 2005 there are various ways of creating new instances of the Person Class.   The common ones are shown in the code sample below:&lt;/FONT&gt;&lt;BR&gt; &lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #aaaaaa 1px solid; BORDER-TOP: #aaaaaa 1px solid; MARGIN-LEFT: 10pt; BORDER-LEFT: #aaaaaa 1px solid; MARGIN-RIGHT: 2pt; BORDER-BOTTOM: #aaaaaa 1px solid"&gt;
&lt;DIV style="FONT-SIZE: 10pt; BORDER-BOTTOM: #aaaaaa 1px solid" onclick="var i=this.sel,j;for(j=0;j&lt;3;j++)this.childNodes[2+j*2].checked=j==i;if(i==this.selold)return;var sh=new Array('none',''),o=this.parentNode;j=i==0?0:1;this.selold=i;o.childNodes[1].style.display=sh[j];o.childNodes[2].style.display=sh[1-j];o=o.childNodes[1];var h =o.offsetHeight;o.style.height=i==1?'150pt':'';if(i==1 &amp;&amp; o.offsetHeight&gt;h)o.style.height=h;" sel="1" selold="1"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy &lt;/A&gt;&lt;INPUT onclick=parentNode.sel=0 type=radio&gt;Hide&lt;INPUT onclick=parentNode.sel=1 type=radio CHECKED&gt;Scroll&lt;INPUT onclick=parentNode.sel=2 type=radio&gt;Full&lt;/DIV&gt;
&lt;DIV style="FONT-SIZE: 15px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'; HEIGHT: 150px; BACKGROUND-COLOR: #efefef"&gt;&lt;FONT color=#0000ff&gt;Module&lt;/FONT&gt; CreateData&lt;BR&gt;&lt;FONT color=#0000ff&gt;    Dim&lt;/FONT&gt; People&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt; List(&lt;FONT color=#0000ff&gt;Of&lt;/FONT&gt; Person)&lt;BR&gt;&lt;FONT color=#0000ff&gt;    Function&lt;/FONT&gt; CreateDataVB8_1()&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt; List(&lt;FONT color=#0000ff&gt;Of&lt;/FONT&gt; Person)&lt;BR&gt;&lt;FONT color=#008000&gt;        '  One of the VB8 ways&lt;/FONT&gt;&lt;BR&gt;        People =&lt;FONT color=#0000ff&gt; New&lt;/FONT&gt; List(&lt;FONT color=#0000ff&gt;Of&lt;/FONT&gt; Person)&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;        Dim&lt;/FONT&gt; P&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; New&lt;/FONT&gt; Person&lt;BR&gt;        P.Forename =&lt;FONT color=#a31515&gt; "Peter"&lt;/FONT&gt;&lt;BR&gt;        P.Surname =&lt;FONT color=#a31515&gt; "Gray"&lt;/FONT&gt;&lt;BR&gt;        P.Gender = Gender.Male&lt;BR&gt;        P.Country =&lt;FONT color=#a31515&gt; "UK"&lt;/FONT&gt;&lt;BR&gt;        P.HomeTown =&lt;FONT color=#a31515&gt; "Leeds"&lt;/FONT&gt;&lt;BR&gt;        P.DateOfBirth =&lt;FONT color=#0000ff&gt; New&lt;/FONT&gt; DateTime(1966, 1, 12)&lt;BR&gt;        People.Add(P)&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;        Return&lt;/FONT&gt; People&lt;BR&gt;&lt;FONT color=#0000ff&gt;    End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Function&lt;BR&gt;&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;    Function&lt;/FONT&gt; CreateDataVB8_2()&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt; List(&lt;FONT color=#0000ff&gt;Of&lt;/FONT&gt; Person)&lt;BR&gt;&lt;FONT color=#008000&gt;        '  One of the VB8 ways&lt;/FONT&gt;&lt;BR&gt;        People =&lt;FONT color=#0000ff&gt; New&lt;/FONT&gt; List(&lt;FONT color=#0000ff&gt;Of&lt;/FONT&gt; Person)&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;        Dim&lt;/FONT&gt; P2&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; New&lt;/FONT&gt; Person&lt;BR&gt;&lt;FONT color=#0000ff&gt;        With&lt;/FONT&gt; P2&lt;BR&gt;            .Forename =&lt;FONT color=#a31515&gt; "Zoe"&lt;/FONT&gt;&lt;BR&gt;            .Surname =&lt;FONT color=#a31515&gt; "Gray"&lt;/FONT&gt;&lt;BR&gt;            .Gender = Gender.Female&lt;BR&gt;            .Country =&lt;FONT color=#a31515&gt; "UK"&lt;/FONT&gt;&lt;BR&gt;            .HomeTown =&lt;FONT color=#a31515&gt; "Wakefield"&lt;/FONT&gt;&lt;BR&gt;            .DateOfBirth =&lt;FONT color=#0000ff&gt; New&lt;/FONT&gt; DateTime(1969, 7, 3)&lt;BR&gt;&lt;FONT color=#0000ff&gt;        End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; With&lt;/FONT&gt;&lt;BR&gt;        People.Add(P2)&lt;BR&gt;&lt;FONT color=#0000ff&gt;        Return&lt;/FONT&gt; People&lt;BR&gt;&lt;FONT color=#0000ff&gt;    End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Function&lt;BR&gt;&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;    Function&lt;/FONT&gt; CreateDataVB8_3()&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt; List(&lt;FONT color=#0000ff&gt;Of&lt;/FONT&gt; Person)&lt;BR&gt;&lt;FONT color=#008000&gt;        '  One of the VB8 ways - Overloaded Constructor&lt;/FONT&gt;&lt;BR&gt;        People =&lt;FONT color=#0000ff&gt; New&lt;/FONT&gt; List(&lt;FONT color=#0000ff&gt;Of&lt;/FONT&gt; Person)&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;        Dim&lt;/FONT&gt; P3&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; New&lt;/FONT&gt; Person(&lt;FONT color=#a31515&gt;"David"&lt;/FONT&gt;,&lt;FONT color=#a31515&gt; "Sedding"&lt;/FONT&gt;, Gender.Male)&lt;BR&gt;        People.Add(P3)&lt;BR&gt;        P3 =&lt;FONT color=#0000ff&gt; New&lt;/FONT&gt; Person(&lt;FONT color=#a31515&gt;"Ricky"&lt;/FONT&gt;,&lt;FONT color=#a31515&gt; "Livid"&lt;/FONT&gt;, Gender.Male)&lt;BR&gt;        People.Add(P3)&lt;BR&gt;&lt;FONT color=#0000ff&gt;        Return&lt;/FONT&gt; People&lt;BR&gt;&lt;FONT color=#0000ff&gt;    End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Function&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Module&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV style="DISPLAY: none; BACKGROUND-COLOR: #efefef"&gt;&lt;B&gt;. . .&lt;/B&gt;&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;     VB9's language enhancements bring some more options in this area.  Some of them may seem to be low on the &lt;EM&gt;Wow!&lt;/EM&gt; factor, but they become more important and more useful as you get further into the whole LINQ scenario.   &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;   One way is to create a new instance and assign values to properties at the same time:-&lt;/FONT&gt;&lt;FONT face=Verdana size=2&gt;&lt;BR&gt;    &lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #aaaaaa 1px solid; BORDER-TOP: #aaaaaa 1px solid; MARGIN-LEFT: 10pt; BORDER-LEFT: #aaaaaa 1px solid; MARGIN-RIGHT: 2pt; BORDER-BOTTOM: #aaaaaa 1px solid"&gt;
&lt;DIV style="FONT-SIZE: 10pt; BORDER-BOTTOM: #aaaaaa 1px solid" onclick="var i=this.sel,j;for(j=0;j&lt;3;j++)this.childNodes[2+j*2].checked=j==i;if(i==this.selold)return;var sh=new Array('none',''),o=this.parentNode;j=i==0?0:1;this.selold=i;o.childNodes[1].style.display=sh[j];o.childNodes[2].style.display=sh[1-j];o=o.childNodes[1];var h =o.offsetHeight;o.style.height=i==1?'150pt':'';if(i==1 &amp;&amp; o.offsetHeight&gt;h)o.style.height=h;" sel="2" selold="2"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy &lt;/A&gt;&lt;INPUT onclick=parentNode.sel=0 type=radio&gt;Hide&lt;INPUT onclick=parentNode.sel=1 type=radio&gt;Scroll&lt;INPUT onclick=parentNode.sel=2 type=radio CHECKED&gt;Full&lt;/DIV&gt;
&lt;DIV style="FONT-SIZE: 15px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'; BACKGROUND-COLOR: #efefef"&gt;&lt;FONT color=#0000ff&gt;Dim&lt;/FONT&gt; P4&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; New&lt;/FONT&gt; Person&lt;FONT color=#0000ff&gt; With&lt;/FONT&gt; {.Forename =&lt;FONT color=#a31515&gt; "Sandi"&lt;/FONT&gt;, .Surname =&lt;FONT color=#a31515&gt; "Skeet"&lt;/FONT&gt;, _&lt;BR&gt;       .DateOfBirth = #12/2/1962#, .Gender = Gender.Female, _&lt;BR&gt;       .HomeTown =&lt;FONT color=#a31515&gt; "Dover"&lt;/FONT&gt;, .Country =&lt;FONT color=#a31515&gt; "UK"&lt;/FONT&gt;}&lt;/DIV&gt;
&lt;DIV style="FONT-SIZE: 15px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'; BACKGROUND-COLOR: #efefef"&gt; &lt;/DIV&gt;
&lt;DIV style="FONT-SIZE: 15px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'; BACKGROUND-COLOR: #efefef"&gt; &lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;    &lt;FONT face=Verdana size=2&gt; Note the use of the "With" keyword which is an extension of the current way of using With.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;   &lt;/FONT&gt; &lt;FONT face=Verdana size=2&gt;Not a million miles away from achieving the same result with an overloaded constructor, you may think.  However, there are some subtle benefits.  One is that you can assign values to the properties in any order.   Another, possibly more useful, is that you can assign values to only those properties you are interested in at the time of initialization.  &lt;/FONT&gt;&lt;FONT face=Verdana size=2&gt;  &lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #aaaaaa 1px solid; BORDER-TOP: #aaaaaa 1px solid; MARGIN-LEFT: 10pt; BORDER-LEFT: #aaaaaa 1px solid; MARGIN-RIGHT: 2pt; BORDER-BOTTOM: #aaaaaa 1px solid"&gt;
&lt;DIV style="FONT-SIZE: 10pt; BORDER-BOTTOM: #aaaaaa 1px solid" onclick="var i=this.sel,j;for(j=0;j&lt;3;j++)this.childNodes[2+j*2].checked=j==i;if(i==this.selold)return;var sh=new Array('none',''),o=this.parentNode;j=i==0?0:1;this.selold=i;o.childNodes[1].style.display=sh[j];o.childNodes[2].style.display=sh[1-j];o=o.childNodes[1];var h =o.offsetHeight;o.style.height=i==1?'150pt':'';if(i==1 &amp;&amp; o.offsetHeight&gt;h)o.style.height=h;" sel="2" selold="2"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy &lt;/A&gt;&lt;INPUT onclick=parentNode.sel=0 type=radio&gt;Hide&lt;INPUT onclick=parentNode.sel=1 type=radio&gt;Scroll&lt;INPUT onclick=parentNode.sel=2 type=radio CHECKED&gt;Full&lt;/DIV&gt;
&lt;DIV style="FONT-SIZE: 15px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'; BACKGROUND-COLOR: #efefef"&gt;P4 =&lt;FONT color=#0000ff&gt; New&lt;/FONT&gt; Person&lt;FONT color=#0000ff&gt; With&lt;/FONT&gt; {.HomeTown =&lt;FONT color=#a31515&gt; "Leeds"&lt;/FONT&gt;, .Forename =&lt;FONT color=#a31515&gt; "Ken"&lt;/FONT&gt;, _&lt;/DIV&gt;
&lt;DIV style="FONT-SIZE: 15px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'; BACKGROUND-COLOR: #efefef"&gt;           .Surname =&lt;FONT color=#a31515&gt; "Browning"&lt;/FONT&gt;, _&lt;BR&gt;           .Gender = Gender.Male, .DateOfBirth = #3/9/1978#}&lt;FONT color=#0000ff&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV style="DISPLAY: none; BACKGROUND-COLOR: #efefef"&gt;&lt;B&gt;. . .&lt;/B&gt;&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;     That said, these benefits are really a side product.   This style of object initialization has been built into VB9 for technical reasons that will become clear later.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;&lt;U&gt;&lt;FONT color=#800000&gt;Creating Collections Of Complex Object Instances&lt;/FONT&gt;&lt;/U&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana color=#000000 size=2&gt;   As you know, you can create instances of the Person class and add them to a collection.   A List (Of Person) for example:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana color=#006400 size=2&gt;&lt;EM&gt;&lt;U&gt;VB 2005&lt;/U&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #aaaaaa 1px solid; BORDER-TOP: #aaaaaa 1px solid; MARGIN-LEFT: 10pt; BORDER-LEFT: #aaaaaa 1px solid; MARGIN-RIGHT: 2pt; BORDER-BOTTOM: #aaaaaa 1px solid"&gt;
&lt;DIV style="FONT-SIZE: 10pt; BORDER-BOTTOM: #aaaaaa 1px solid" onclick="var i=this.sel,j;for(j=0;j&lt;3;j++)this.childNodes[2+j*2].checked=j==i;if(i==this.selold)return;var sh=new Array('none',''),o=this.parentNode;j=i==0?0:1;this.selold=i;o.childNodes[1].style.display=sh[j];o.childNodes[2].style.display=sh[1-j];o=o.childNodes[1];var h =o.offsetHeight;o.style.height=i==1?'150pt':'';if(i==1 &amp;&amp; o.offsetHeight&gt;h)o.style.height=h;" sel="1" selold="1"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy &lt;/A&gt;&lt;INPUT onclick=parentNode.sel=0 type=radio&gt;Hide&lt;INPUT onclick=parentNode.sel=1 type=radio CHECKED&gt;Scroll&lt;INPUT onclick=parentNode.sel=2 type=radio&gt;Full&lt;/DIV&gt;
&lt;DIV style="FONT-SIZE: 15px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'; HEIGHT: 150px; BACKGROUND-COLOR: #efefef"&gt;&lt;FONT color=#0000ff&gt;Dim&lt;/FONT&gt; People&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; New&lt;/FONT&gt; List(&lt;FONT color=#0000ff&gt;Of&lt;/FONT&gt; Person)&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;   Dim&lt;/FONT&gt; P&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; New&lt;/FONT&gt; Person&lt;BR&gt;        P.Forename =&lt;FONT color=#a31515&gt; "Peter"&lt;/FONT&gt;&lt;BR&gt;        P.Surname =&lt;FONT color=#a31515&gt; "Gray"&lt;/FONT&gt;&lt;BR&gt;        P.Gender = Gender.Male&lt;BR&gt;        P.Country =&lt;FONT color=#a31515&gt; "UK"&lt;/FONT&gt;&lt;BR&gt;        P.HomeTown =&lt;FONT color=#a31515&gt; "Leeds"&lt;/FONT&gt;&lt;BR&gt;        P.DateOfBirth =&lt;FONT color=#0000ff&gt; New&lt;/FONT&gt; DateTime(1966, 1, 12)&lt;BR&gt;People.Add(P)&lt;FONT color=#0000ff&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV style="DISPLAY: none; BACKGROUND-COLOR: #efefef"&gt;&lt;B&gt;. . .&lt;/B&gt;&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;EM&gt;&lt;U&gt;&lt;FONT face=Verdana color=#006400 size=2&gt;VB 9 (ORCAS)&lt;/FONT&gt;&lt;/U&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #aaaaaa 1px solid; BORDER-TOP: #aaaaaa 1px solid; FONT-SIZE: 10pt; MARGIN-LEFT: 10pt; BORDER-LEFT: #aaaaaa 1px solid; MARGIN-RIGHT: 2pt; BORDER-BOTTOM: #aaaaaa 1px solid" onclick="var i=this.sel,j;for(j=0;j&lt;3;j++)this.childNodes[2+j*2].checked=j==i;if(i==this.selold)return;var sh=new Array('none',''),o=this.parentNode;j=i==0?0:1;this.selold=i;o.childNodes[1].style.display=sh[j];o.childNodes[2].style.display=sh[1-j];o=o.childNodes[1];var h =o.offsetHeight;o.style.height=i==1?'150pt':'';if(i==1 &amp;&amp; o.offsetHeight&gt;h)o.style.height=h;" sel="1" selold="1"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy &lt;/A&gt;&lt;INPUT onclick=parentNode.sel=0 type=radio&gt;Hide&lt;INPUT onclick=parentNode.sel=1 type=radio CHECKED&gt;Scroll&lt;INPUT onclick=parentNode.sel=2 type=radio&gt;Full&lt;/DIV&gt;
&lt;DIV style="BORDER-RIGHT: #aaaaaa 1px solid; BORDER-TOP: #aaaaaa 1px solid; MARGIN-LEFT: 10pt; BORDER-LEFT: #aaaaaa 1px solid; MARGIN-RIGHT: 2pt; BORDER-BOTTOM: #aaaaaa 1px solid"&gt;
&lt;DIV style="FONT-SIZE: 15px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'; HEIGHT: 150px; BACKGROUND-COLOR: #efefef"&gt;&lt;FONT color=#0000ff&gt;Dim&lt;/FONT&gt; PersonList&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; New&lt;/FONT&gt; List(&lt;FONT color=#0000ff&gt;Of&lt;/FONT&gt; Person)&lt;BR&gt;&lt;FONT color=#008000&gt;    '  Object Initializer way:&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;    Dim&lt;/FONT&gt; P4&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; New&lt;/FONT&gt; Person&lt;FONT color=#0000ff&gt; With&lt;/FONT&gt; {.Forename =&lt;FONT color=#a31515&gt; "Sandi"&lt;/FONT&gt;, .Surname =&lt;FONT color=#a31515&gt; "Skeet"&lt;/FONT&gt;, _&lt;BR&gt;       .DateOfBirth = #12/2/1962#, .Gender = Gender.Female, _&lt;BR&gt;       .HomeTown =&lt;FONT color=#a31515&gt; "Dover"&lt;/FONT&gt;, .Country =&lt;FONT color=#a31515&gt; "UK"&lt;/FONT&gt;}&lt;BR&gt;&lt;BR&gt;   PersonList.Add(P4)&lt;BR&gt;&lt;FONT color=#008000&gt;    '  Note that the Properties can be set in totally random order,&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#008000&gt;    '  unlike parameters.&lt;/FONT&gt;&lt;BR&gt;    P4 =&lt;FONT color=#0000ff&gt; New&lt;/FONT&gt; Person&lt;FONT color=#0000ff&gt; With&lt;/FONT&gt; {.HomeTown =&lt;FONT color=#a31515&gt; "Leeds"&lt;/FONT&gt;, .Forename =&lt;FONT color=#a31515&gt; "Ken"&lt;/FONT&gt;, _&lt;BR&gt;         .Surname =&lt;FONT color=#a31515&gt; "Browning"&lt;/FONT&gt;, .Gender = Gender.Male, _&lt;BR&gt;         .DateOfBirth = #3/9/1978#, .Country =&lt;FONT color=#a31515&gt; "UK"&lt;/FONT&gt;}&lt;BR&gt;&lt;BR&gt;PersonList.Add(P4)&lt;FONT color=#0000ff&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;    &lt;FONT face=Verdana color=#000000 size=2&gt;The second example above is a kind of halfway house between VB8 and VB9.   There are other  ways available in VB9.   You can initialize New Person instances, assign values to any or all properties and then add that instance to the collection:&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #aaaaaa 1px solid; BORDER-TOP: #aaaaaa 1px solid; MARGIN-LEFT: 10pt; BORDER-LEFT: #aaaaaa 1px solid; MARGIN-RIGHT: 2pt; BORDER-BOTTOM: #aaaaaa 1px solid"&gt;
&lt;DIV style="FONT-SIZE: 10pt; BORDER-BOTTOM: #aaaaaa 1px solid" onclick="var i=this.sel,j;for(j=0;j&lt;3;j++)this.childNodes[2+j*2].checked=j==i;if(i==this.selold)return;var sh=new Array('none',''),o=this.parentNode;j=i==0?0:1;this.selold=i;o.childNodes[1].style.display=sh[j];o.childNodes[2].style.display=sh[1-j];o=o.childNodes[1];var h =o.offsetHeight;o.style.height=i==1?'150pt':'';if(i==1 &amp;&amp; o.offsetHeight&gt;h)o.style.height=h;" sel="2" selold="2"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy &lt;/A&gt;&lt;INPUT onclick=parentNode.sel=0 type=radio&gt;Hide&lt;INPUT onclick=parentNode.sel=1 type=radio&gt;Scroll&lt;INPUT onclick=parentNode.sel=2 type=radio CHECKED&gt;Full&lt;/DIV&gt;
&lt;DIV style="FONT-SIZE: 15px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'; BACKGROUND-COLOR: #efefef"&gt;&lt;FONT color=#0000ff&gt;Dim&lt;/FONT&gt; SomePeople()&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt; Person = _&lt;BR&gt;       {&lt;FONT color=#0000ff&gt;New&lt;/FONT&gt; Person&lt;FONT color=#0000ff&gt; With&lt;/FONT&gt; {.Forename =&lt;FONT color=#a31515&gt; "Jan"&lt;/FONT&gt;, .Surname =&lt;FONT color=#a31515&gt; "Urqhart"&lt;/FONT&gt;, _&lt;BR&gt;         .DateOfBirth = #9/8/1959#, .Gender = Gender.Female, _&lt;BR&gt;         .Country =&lt;FONT color=#a31515&gt; "Belgium"&lt;/FONT&gt;, .HomeTown =&lt;FONT color=#a31515&gt; "Ghent"&lt;/FONT&gt;}, _&lt;BR&gt;&lt;FONT color=#0000ff&gt;       New&lt;/FONT&gt; Person&lt;FONT color=#0000ff&gt; With&lt;/FONT&gt; {.Surname =&lt;FONT color=#a31515&gt; "Fleischmann"&lt;/FONT&gt;, .Forename =&lt;FONT color=#a31515&gt; "Heinje"&lt;/FONT&gt;, .Country =&lt;FONT color=#a31515&gt; "Belgium"&lt;/FONT&gt;, _&lt;BR&gt;         .Gender = Gender.Male, .DateOfBirth = #7/11/1982#, .HomeTown =&lt;FONT color=#a31515&gt; "Mons"&lt;/FONT&gt;}} 
&lt;DIV style="DISPLAY: none; BACKGROUND-COLOR: #efefef"&gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;      &lt;FONT face=Verdana size=2&gt;The &lt;EM&gt;With &lt;/EM&gt;keyword is used again in the above example to assign values to properties.  You will see that it creates an array of Person instances and that I included the identifier "As Person" in the first line.    However, VB9 goes further and the compiler is able to infer what Type the array will contain by looking at the Type you populate it with.   So the following version of the above snippet will compile without error and the SomePeople array will be correctly typed as Person type.&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #aaaaaa 1px solid; BORDER-TOP: #aaaaaa 1px solid; MARGIN-LEFT: 10pt; BORDER-LEFT: #aaaaaa 1px solid; MARGIN-RIGHT: 2pt; BORDER-BOTTOM: #aaaaaa 1px solid"&gt;
&lt;DIV style="FONT-SIZE: 10pt; BORDER-BOTTOM: #aaaaaa 1px solid" onclick="var i=this.sel,j;for(j=0;j&lt;3;j++)this.childNodes[2+j*2].checked=j==i;if(i==this.selold)return;var sh=new Array('none',''),o=this.parentNode;j=i==0?0:1;this.selold=i;o.childNodes[1].style.display=sh[j];o.childNodes[2].style.display=sh[1-j];o=o.childNodes[1];var h =o.offsetHeight;o.style.height=i==1?'150pt':'';if(i==1 &amp;&amp; o.offsetHeight&gt;h)o.style.height=h;" sel="2" selold="2"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy &lt;/A&gt;&lt;INPUT onclick=parentNode.sel=0 type=radio&gt;Hide&lt;INPUT onclick=parentNode.sel=1 type=radio&gt;Scroll&lt;INPUT onclick=parentNode.sel=2 type=radio CHECKED&gt;Full&lt;/DIV&gt;
&lt;DIV style="FONT-SIZE: 15px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'; BACKGROUND-COLOR: #efefef"&gt;&lt;FONT color=#0000ff&gt;Dim&lt;/FONT&gt; SomePeople() = _&lt;BR&gt;       {&lt;FONT color=#0000ff&gt;New&lt;/FONT&gt; Person&lt;FONT color=#0000ff&gt; With&lt;/FONT&gt; {.Forename =&lt;FONT color=#a31515&gt; "Jan"&lt;/FONT&gt;, .Surname =&lt;FONT color=#a31515&gt; "Urqhart"&lt;/FONT&gt;, _&lt;BR&gt;         .DateOfBirth = #9/8/1959#, .Gender = Gender.Female, _&lt;BR&gt;         .Country =&lt;FONT color=#a31515&gt; "Belgium"&lt;/FONT&gt;, .HomeTown =&lt;FONT color=#a31515&gt; "Ghent"&lt;/FONT&gt;}, _&lt;BR&gt;&lt;FONT color=#0000ff&gt;       New&lt;/FONT&gt; Person&lt;FONT color=#0000ff&gt; With&lt;/FONT&gt; {.Surname =&lt;FONT color=#a31515&gt; "Fleischmann"&lt;/FONT&gt;, .Forename =&lt;FONT color=#a31515&gt; "Heinje"&lt;/FONT&gt;, .Country =&lt;FONT color=#a31515&gt; "Belgium"&lt;/FONT&gt;, _&lt;BR&gt;         .Gender = Gender.Male, .DateOfBirth = #7/11/1982#, .HomeTown =&lt;FONT color=#a31515&gt; "Mons"&lt;/FONT&gt;}}&lt;FONT color=#0000ff&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV style="DISPLAY: none; BACKGROUND-COLOR: #efefef"&gt;&lt;B&gt;. . .&lt;/B&gt;&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;    &lt;FONT face=Verdana size=2&gt;In case you were wondering if this is Late Binding the array to the Person Type, this is definitely not the case.     It's important to note that this array is Early Bound.   This feature is known as Local Type Inference, one of the language enhancements in VB9.   And, as with the new initialization techniques, the underlying reason for this feature being included is also for technical reasons to help make LINQ work and not just to add yet one more way of creating a new collection.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;FONT face=Verdana color=#800000&gt;At Last! A LINQ Query Example &lt;/FONT&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;   &lt;FONT face=Verdana size=2&gt;Although we still have several important language enhancements to cover, we can at this stage run a simple LINQ query.   A LINQ query is a sequence of clauses, each clause containing a Query Operator.   Query Operators include From, Where, Select, Join, Group By, etc, all of which are familiar sounding keywords if you have used SQL.  &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;   The following example creates and initializes an array of Person instances using the above technique.  It then runs a simple LINQ query to find all Persons who have a birthday this month.&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #aaaaaa 1px solid; BORDER-TOP: #aaaaaa 1px solid; MARGIN-LEFT: 10pt; BORDER-LEFT: #aaaaaa 1px solid; MARGIN-RIGHT: 2pt; BORDER-BOTTOM: #aaaaaa 1px solid"&gt;
&lt;DIV style="FONT-SIZE: 10pt; BORDER-BOTTOM: #aaaaaa 1px solid" onclick="var i=this.sel,j;for(j=0;j&lt;3;j++)this.childNodes[2+j*2].checked=j==i;if(i==this.selold)return;var sh=new Array('none',''),o=this.parentNode;j=i==0?0:1;this.selold=i;o.childNodes[1].style.display=sh[j];o.childNodes[2].style.display=sh[1-j];o=o.childNodes[1];var h =o.offsetHeight;o.style.height=i==1?'150pt':'';if(i==1 &amp;&amp; o.offsetHeight&gt;h)o.style.height=h;" sel="1" selold="1"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy &lt;/A&gt;&lt;INPUT onclick=parentNode.sel=0 type=radio&gt;Hide&lt;INPUT onclick=parentNode.sel=1 type=radio CHECKED&gt;Scroll&lt;INPUT onclick=parentNode.sel=2 type=radio&gt;Full&lt;/DIV&gt;
&lt;DIV style="FONT-SIZE: 15px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'; HEIGHT: 150px; BACKGROUND-COLOR: #efefef"&gt;&lt;FONT color=#008000&gt;        '  Create Data&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;        Dim&lt;/FONT&gt; PersonList() = _&lt;BR&gt;          {&lt;FONT color=#0000ff&gt;New&lt;/FONT&gt; Person&lt;FONT color=#0000ff&gt; With&lt;/FONT&gt; {.Forename =&lt;FONT color=#a31515&gt; "Jan"&lt;/FONT&gt;, .Surname =&lt;FONT color=#a31515&gt; "Urqhart"&lt;/FONT&gt;, _&lt;BR&gt;             .DateOfBirth = #6/6/1959#, .Gender = Gender.Female, _&lt;BR&gt;             .Country =&lt;FONT color=#a31515&gt; "Belgium"&lt;/FONT&gt;, .HomeTown =&lt;FONT color=#a31515&gt; "Ghent"&lt;/FONT&gt;}, _&lt;BR&gt;&lt;FONT color=#0000ff&gt;           New&lt;/FONT&gt; Person&lt;FONT color=#0000ff&gt; With&lt;/FONT&gt; {.Surname =&lt;FONT color=#a31515&gt; "Fleischmann"&lt;/FONT&gt;, .Forename =&lt;FONT color=#a31515&gt; "Heinje"&lt;/FONT&gt;, _&lt;BR&gt;             .Country =&lt;FONT color=#a31515&gt; "Belgium"&lt;/FONT&gt;, .Gender = Gender.Male, _&lt;BR&gt;             .DateOfBirth = #5/15/1982#, .HomeTown =&lt;FONT color=#a31515&gt; "Mons"&lt;/FONT&gt;}, _&lt;BR&gt;&lt;FONT color=#0000ff&gt;           New&lt;/FONT&gt; Person&lt;FONT color=#0000ff&gt; With&lt;/FONT&gt; {.Forename =&lt;FONT color=#a31515&gt; "Sandi"&lt;/FONT&gt;, .Surname =&lt;FONT color=#a31515&gt; "Skeet"&lt;/FONT&gt;, _&lt;BR&gt;             .DateOfBirth = #6/15/1962#, .Gender = Gender.Female, _&lt;BR&gt;             .HomeTown =&lt;FONT color=#a31515&gt; "Dover"&lt;/FONT&gt;, .Country =&lt;FONT color=#a31515&gt; "UK"&lt;/FONT&gt;}, _&lt;BR&gt;&lt;FONT color=#0000ff&gt;           New&lt;/FONT&gt; Person&lt;FONT color=#0000ff&gt; With&lt;/FONT&gt; {.HomeTown =&lt;FONT color=#a31515&gt; "Leeds"&lt;/FONT&gt;, .Forename =&lt;FONT color=#a31515&gt; "Ken"&lt;/FONT&gt;, .Surname =&lt;FONT color=#a31515&gt; "Browning"&lt;/FONT&gt;, _&lt;BR&gt;              .Gender = Gender.Male, .DateOfBirth = #5/9/1978#, .Country =&lt;FONT color=#a31515&gt; "UK"&lt;/FONT&gt;}}&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#008000&gt;        '  Run LINQ Query&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;        Dim&lt;/FONT&gt; BirthdayPeople =&lt;FONT color=#0000ff&gt; From&lt;/FONT&gt; p&lt;FONT color=#0000ff&gt; In&lt;/FONT&gt; PersonList _&lt;BR&gt;&lt;FONT color=#0000ff&gt;            Where&lt;/FONT&gt; p.DateOfBirth.Month = Now.Month _&lt;BR&gt;&lt;FONT color=#0000ff&gt;            Select&lt;/FONT&gt; p&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#008000&gt;        '  Display results of query&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;        If&lt;/FONT&gt; BirthdayPeople.Count &gt; 0&lt;FONT color=#0000ff&gt; Then&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;            For&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Each&lt;/FONT&gt; p&lt;FONT color=#0000ff&gt; In&lt;/FONT&gt; BirthdayPeople&lt;BR&gt;                Console.WriteLine(&lt;FONT color=#a31515&gt;"Happy Birthday,  "&lt;/FONT&gt; &amp; p.Forename)&lt;FONT color=#008000&gt;   '&amp; "  :  " &amp; p.DateOfBirth.ToLongDateString)&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;            Next&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;        Else&lt;/FONT&gt;&lt;BR&gt;            Console.WriteLine(&lt;FONT color=#a31515&gt;"No Birthdays this month"&lt;/FONT&gt;)&lt;BR&gt;&lt;FONT color=#0000ff&gt;        End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; If&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV style="DISPLAY: none; BACKGROUND-COLOR: #efefef"&gt;&lt;B&gt;. . .&lt;/B&gt;&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;      &lt;FONT face=Verdana size=2&gt;Note that the query again uses Local Type Inference to decide that the Type of the collection is Person as it creates BirthdayPeople and also that p is a Person Type, because p is an element in a list of Persons.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;   The query itself is very simple;  using the &lt;EM&gt;Where&lt;/EM&gt; query operator it filters in any Person instance where the  DateOfBirth's month property is the same as the current month.   &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;   The final line of this query uses the &lt;EM&gt;Select&lt;/EM&gt; Operator to project or collect the matching entries into the BirthdayPeople collection.   Note the order of "Where" and "Select" in this LINQ query; it is the reverse of the syntax you would usually use for SQL queries against a database.  This is one of the possible Gotchas you will need to keep in mind as you begin using LINQ, but you will in fact find that the IDE syntax editor will bark at you if try using "Select" before "Where".&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;   Once the query has been run, the final code block displays the results in a console window. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;&lt;U&gt;&lt;FONT color=#800000 size=3&gt;Next Steps&lt;/FONT&gt;&lt;/U&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;   A very basic LINQ  query there which, to be fair, would be just as easy to create using a simple For Next Loop. &lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #aaaaaa 1px solid; BORDER-TOP: #aaaaaa 1px solid; MARGIN-LEFT: 10pt; BORDER-LEFT: #aaaaaa 1px solid; MARGIN-RIGHT: 2pt; BORDER-BOTTOM: #aaaaaa 1px solid"&gt;
&lt;DIV style="FONT-SIZE: 10pt; BORDER-BOTTOM: #aaaaaa 1px solid" onclick="var i=this.sel,j;for(j=0;j&lt;3;j++)this.childNodes[2+j*2].checked=j==i;if(i==this.selold)return;var sh=new Array('none',''),o=this.parentNode;j=i==0?0:1;this.selold=i;o.childNodes[1].style.display=sh[j];o.childNodes[2].style.display=sh[1-j];o=o.childNodes[1];var h =o.offsetHeight;o.style.height=i==1?'150pt':'';if(i==1 &amp;&amp; o.offsetHeight&gt;h)o.style.height=h;" sel="1" selold="1"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy &lt;/A&gt;&lt;INPUT onclick=parentNode.sel=0 type=radio&gt;Hide&lt;INPUT onclick=parentNode.sel=1 type=radio CHECKED&gt;Scroll&lt;INPUT onclick=parentNode.sel=2 type=radio&gt;Full&lt;/DIV&gt;
&lt;DIV style="FONT-SIZE: 15px; OVERFLOW: auto; FONT-FAMILY: 'Courier New'; HEIGHT: 150px; BACKGROUND-COLOR: #efefef"&gt;&lt;FONT color=#0000ff&gt;  Dim&lt;/FONT&gt; BirthdayPeople&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; New&lt;/FONT&gt; List(&lt;FONT color=#0000ff&gt;Of&lt;/FONT&gt; Person)&lt;BR&gt;&lt;FONT color=#0000ff&gt;        For&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Each&lt;/FONT&gt; P&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt; Person&lt;FONT color=#0000ff&gt; In&lt;/FONT&gt; People&lt;BR&gt;&lt;FONT color=#0000ff&gt;            If&lt;/FONT&gt; P.DateOfBirth.Month = Now.Month&lt;FONT color=#0000ff&gt; Then&lt;/FONT&gt;&lt;BR&gt;                BirthdayPeople.Add(P)&lt;BR&gt;&lt;FONT color=#0000ff&gt;            End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; If&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;        Next&lt;BR&gt;&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;        If&lt;/FONT&gt; BirthdayPeople.Count &gt; 0&lt;FONT color=#0000ff&gt; Then&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;            For&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; Each&lt;/FONT&gt; bp&lt;FONT color=#0000ff&gt; As&lt;/FONT&gt; Person&lt;FONT color=#0000ff&gt; In&lt;/FONT&gt; BirthdayPeople&lt;BR&gt;                Console.WriteLine(&lt;FONT color=#a31515&gt;"Happy Birthday,  "&lt;/FONT&gt; &amp; bp.Forename)&lt;BR&gt;&lt;FONT color=#0000ff&gt;            Next&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000ff&gt;        End&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; If&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV style="DISPLAY: none; BACKGROUND-COLOR: #efefef"&gt;&lt;B&gt;. . .&lt;/B&gt;&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;       So, if at this point you are asking yourself  what all the fuss and excitement is about, don't worry, there is more,  so much more, to come.  This relatively slow start is just meant to set the scene.    What about a query that selects all Males who do not live in the UK,  grouped by Country, sorted ascending by Surname then Forename?  Try that with a For Next Loop or two   &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;   Or a query that selects all Persons over the age of 21, use a Join to a second collection which contains the names of towns where courses are currently available and produces a list of names of eligible people to invite to a course in their home town.   Grouped by Towns.   Sorted alphabetically.   Now, once you start to move into that kind of territory you can see how powerful LINQ queries will be.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;   We will look at more complex LINQ To Objects queries in the next part of this article.&lt;/FONT&gt;&lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/xtab/aggbug/8261.aspx" width = "1" height = "1" /&gt;</description></item></channel></rss>