, LINQ works with any data with origins in the iterator.
Overall, Shaw said, LINQ statements are "lightweight and simpler to use than typed datasets, and they are better suited for data updates." The overhead, he added, is no moreso than if a programmer wrote his own For or ForEach loops at runtime.
"All these things I urge you to use with caution"
Shawn Wildermuth, president of Wildermuth Consulting Services, LLC, agrees that LINQ offers an healthy alternative to ForEach statements and that its support for numerous data types, from the well-advertised SQL and XML to Flickr and Amazon, provides a level of homogeneity previously unseen.
However, Wildermuth told the New England Visual Basic Professionals User Group, LINQ is just another tool in the toolbox. "This isn't going to change the way people develop. It's not going to force people to rearchitect solutions," he said. "A lot of this is performance characteristics versus labor and ease of use."
Expanding on the latter point, Wildermuth noted that, while LINQ works well for RAD projects and does make code cleaner, it may not be ideal for large deployments. "With LINQ, a lot of code runs at compile time," he said. "Just because it's LINQ doesn't mean it's going to go faster."
Wildermuth also preached caution regarding use of some of the language features Microsoft introduced to Visual Basic 2008 and C# 3.0 in order to accommodate LINQ.
Variable inferences, for example, let programmers define a type without known the type, while extension methods let programmers define classes on methods they do not own, which could be very confusing, particularly during debugging, he said.
Two other .NET Framework 3.5 features -- anonymous types, which are ad hoc definitions of types and properties, and lambda functions, which are shortcuts for anonymous delegates -- are more useful, but it will take developers some time to get used to them, Wildermuth said.
Back to basics
We end with the latest article to provide a concise introduction to LINQ. It's called Learn the Basics of LINQ, and is provides some thoughts on using extension methods and lambda expressions for those who opt to take the plunge.