LINQ Microsoft demonstrated a new technology at PDC called LINQ (Language Integrated Query). The following note from Alan Griver, a member of the LINQ team at Microsoft, offers some details related to the LINQ project. In future issues of CoDe Magazine we will have more details on LINQ. At PDC, Microsoft announced the Language Integrated Query framework (the LINQ Project). The LINQ Project is a set of language extensions to C# and Visual Basic and a unified programming model that extends the .NET Framework to offer integrated querying for objects, databases, and XML. You can query against any of these three data sources, mixing and matching as appropriate. So, for instance, today we showed querying against a database table and an array, and then turned the output into XML. LINQ is made up of a set of core query operators that can be applied to any .NET array or collection of objects, effectively providing SQL-like capabilities for in-memory data. Additionally, we are providing two APIs, codenamed DLinq (for SQL relational data access) and XLinq (for XML access). These capabilities are available to any language that implements the core requirements of LINQ - currently we are showing implementations in Visual Basic and C#. Here is a simple example of creating an array and then selecting the values over five: Dim primes = {1, 2, 3, 5, 7, 9, 11, 13} Dim primesOverFive = _ Select p From p In primes Where p > 5
The cool thing is that this works against any IEnumerable, so you can go against the .NET Framework classes as well. In this example, we get the process name from the .NET GetProcess() call and limit it to those with more than 6 threads: Dim procs = Select p.ProcessName _ From p In Process.GetProcesses() _ Where p.Threads.Count > 6
It goes a lot further, but this is the idea. We’ve set up some sites with white papers, RSS feeds, and bits you can download that work with VS2005. (The online bits for C# are for Beta 2 of VS2005, the online bits for VB are for the Release Candidate of VS2005) http://msdn.microsoft.com/netframework/future/linq/ http://msdn.microsoft.com/vbasic/future/ You’ll be seeing a lot more coming from these sites. Yair Alan Griver | & | | 
By: Yair Alan Griver Yair Alan Griver is the architect for the Microsoft.com community properties. As architect, he is responsible for creating a coherent underlying platform for properties that include blogs.msdn.com, forums.msdn.com, GotDotNet, chats and CodePlex. In addition to MSCOM architect, Alan is also responsible for the continued development of Visual FoxPro. Prior to the architect role, Alan was Group Manager for the Visual Studio Data group. As Group Manager, Alan’s teams produced the tools used inside of Visual Studio .NET, Office and SQL Server that surface data capabilities, as well as Visual FoxPro. Prior to this position, Alan was a Lead Program Manager and Community Evangelist for Visual Basic .NET, driving community interests into Visual Basic .NET. Before joining Microsoft, Alan was Chief Information Officer at GoAmerica, a publicly traded telecommunications (wireless internet) company, and co-founder and CIO of Flash Creative Management a business strategy and technology consulting company. Alan is the author of five books on Visual FoxPro and Visual Basic, the creator of various development frameworks, and has developed database systems ranging into the thousands of users. He has spoken around the world on databases, object orientation and development team management issues, as well as XML and messaging-based applications.
|