Rob Garrett - Blogs

Welcome to Rob Garrett - Blogs Sign in | Join | Help
in Search
Google

Software/Technology Discussion

Software and Technology Tid-bits

Tech Preview: LINQ

This morning I've been checking out LINQ - Language Integrated Query from Microsoft, on Channel 9. LINQ enables developers to query any IEnumerable<T> collection  with a simple query, much like that of SQL.

Check out the following piece of LINQ code, which queries all the non-static methods supported by System.String, and displays the number of overloads for each method:

The code above defines a query q, which queries the collection, returned by GetMethods.  The query orders on the method name, selects only methods that are no static (notice how LINQ is strongly typed - m.IsStatic works because m is strongly typed to the MethodInfo class), and groups the results into a collection of objects defined on the fly.  The count of overloads is defined by the number of methods in each group. Lastly, the code iterates the over the collection of objects in the query collection and displays the method name and overloads count.

Also read about DLINQ - Language Integrated Query for Databases - and XLINQ - Language Integrated Query for XML.

LINQ was announced at PDC '05, and is only a tech preview for now.  The above code is likely to change before it ever reaches production.
Share this post: Email it! | bookmark it! | digg it! | reddit!
Published Wednesday, September 14, 2005 11:23 AM by Rob Garrett

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

No Comments

Leave a Comment

(required) 
(optional)
(required) 
Submit

Blurb


Head Shot
Rob Garrett is a British Expat living in Maryland USA. Rob is a trained software engineer and experienced in Windows .NET development.

Rob enjoys listening to Rock music, posting to blogs, driving in the country with the sunroof open, beer (not in conjunction with country driving) and spending time with his family.

This Blog

Syndication

Powered by Community Server, by Telligent Systems