LINQ resources

January 14, 2009

I have had the occassion to use a lot of LINQ to objects lately. I remembered there was a great resource for this, but couldn’t remember where that resource was. So, I’m posting it here now so I won’t lose it. I’ll update it as I find more linqs (okay bad pun, and I don’t care).

We recently reviewed recursive SQL and I wrote a query which will return the numbers in the Fibonacci sequence which are less than 100. (This is for DB2)

With FIBONACCI (FRST, SCND) AS

(SELECT 1, 1 FROM SYSIBM.SYSDUMMY1

 UNION ALL 

 SELECT SCND, FRST + SCND 

 FROM FIBONACCI

 WHERE SCND < 100  )   SELECT FRST FROM FIBONACCI; [/sourcecode] The source code here was placed in here using a shortcode as pointed out here.