Published Thursday, June 28, 2007 1:47 AM by martin

C#3 Linq Demo Source Code

Yesterday I did a short talk on C#3 and LINQ.  I've packaged up the source code that I used, and you can download it here.  I don't know how useful the code is without me talking alongside it (maybe more useful) so I'll try to give some pointers to following it...

  • Don't expect the project to do anything much when you run it - the source code is just for looking at.
  • You'll need Visual Studio 2008 (codename "Orcas") Beta 1 to work with this code.  Download it here. (Various downloads are available, if you don't like the version I've linked to).
  • I encourage you to type in the same lines that I have, to see how Intellisense supports you with a surprising amount of knowledge about your code.
  • Most of the language features I talked about are used in Person.cs and PersonHelper.cs.
  • Example1.cs shows the difference made by Object Initializers.
  • Example2.cs illustrates that query expressions are more readable than equivalent procedural code.
  • Example3.cs contrasts a C#2 SQL database query with one that uses a C#3 query expression.
  • I have put comments throughout the code - hopefully you can make sense of it.

The slides I used for yesterday's talk are also available.  Get them here.

 

Technorati tags: , , ,

Filed Under: