LINQ is Not Just for SQL

Posted in LINQ, Programming on January 6th, 2009 by admin – Be the first to comment
It seems like a lot of developers that I know tend to think of LINQ only as a way to query a SQL Server database.  While it is excellent for that, LINQ to SQL is actually just an extension of the base functionality.  I’m urging my co-workers to take a look at the “Standard Query Operators”.  You can find a very good reference here:  http://www.hookedonlinq.com/StandardQueryOperators.ashx.
 
One of the nice things about LINQ is you can query just about any collection or array in the same manner as you might query a table in a database.  Rather than checking each item and filtering out what you DON’T want, you can specify in LINQ syntax what you DO want in a very natural looking language and then iterate over those items that match.
 
Also remember that if you are not working on a .NET 3.5 project and you want to use this syntax in your .NET 2.0 project, then go here:  http://www.albahari.com/nutshell/linqbridge.aspx and download LINQBridge.dll.  Not only will this allow you to use more efficient syntax, it will make your code forward compatible for when you are able to switch your project to .NET 3.5.

Sandy Beach

Posted in Hawaii on January 3rd, 2009 by admin – Be the first to comment
 

0103091353.jpg, originally uploaded by slmcmahon.

Halona Blow Hole

Posted in Hawaii on January 3rd, 2009 by admin – Be the first to comment
 

0103091352.jpg, originally uploaded by slmcmahon.

Entrance to “From Here to Eternity Beach”

Posted in Hawaii on January 3rd, 2009 by admin – Be the first to comment
 

0103091348.jpg, originally uploaded by slmcmahon.

Kualoa Regional Park

Posted in Hawaii on January 3rd, 2009 by admin – Be the first to comment
 

0103091109.jpg, originally uploaded by slmcmahon.

Mokoli`i Islet

Posted in Hawaii on January 3rd, 2009 by admin – Be the first to comment
 

0103091101.jpg, originally uploaded by slmcmahon.

Coming home from the beach

Posted in Hawaii on January 1st, 2009 by admin – Be the first to comment

Waimanalo Beach Park

Posted in Hawaii on January 1st, 2009 by admin – Be the first to comment

Using LINQ in .NET 2.0

Posted in LINQ, Programming on December 31st, 2008 by admin – Be the first to comment

I work in a large organization on both client and server .NET code. A few months ago we were approved to use .NET 3.5 in our server applications, but for client applications we are still restricted to 2.0 code in order to support all clients, some of which are unfortunately still using Windows 2000. Once I started using LINQ syntax in my server code, it seemed like major drudgery to go back and work on our client applications. I noticed though, after we switched over to Visual Studio 2008 for our client code, that a code analyzer that I use was suggesting that I use local variable inference and object initializers. This was irritating and frustrating so I decided to do some web research to find out how to disable those checks.

What I found in this article was surprising. You actually CAN use that syntax in .NET 2.0 targeted applications in Visual Studio 2008. Apparently the environment is smart enough to translate this syntax into something that can be compiled into .NET 2.0 assemblies.

After I spent some more time looking into that, I stumbled upon the LINQBridge Project. This library actually allows you to use LINQ to Objects syntax in your .NET 2.0 code. It is doesn’t support LINQ to SQL and LINQ to XML, but being able to use extension methods, comprehension queries and lambda expressions against collections is certainly enough to get me excited about it.

In the organization that I work in, there are actually thousands of machines that DO have the .NET 3.5 framework, so I was concerned about how those machines would handle this library. According to the LINQBridge site, having .NET 3.5 on the target machine is no problem. It states “The presence of Framework 3.5 does not impede LINQBridge in any way. If your project references LINQBridge during compilation, then it will bind to LINQBridge’s query operators; if it references System.Core during compilation, then it will bind to Framework 3.5’s query operators.”

Excellent Coding Horror Blog Entry

Posted in Programming on December 30th, 2008 by admin – Be the first to comment

I’m a long-time reader of Jeff Atwood’s blog, “Coding Horror“.  This is no doubt the best one that I’ve read yet:  Programming: Love It or Leave It.