Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

LINQ project?

  1. Apr 8, 2007 #1


    User Avatar
    Science Advisor

    EDIT: I meant to post this in the Programming Forum, if a mod can please move it...

    Have you heard of the LINQ project? I recently came accross it.
    Since .NET 3.x is going to support Lambda expressions, .NET developers will introduce LINQ (Language Integrated Query) which supports SQL-like statements for arrays and collections.
    Along with it are coming XLing and Dling for creating classes which integrate seamlessly with an XML or Database schema respectively.
    Here are some examples:
    Code (Text):

    public void Linq6() {
        int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };

        var numsPlusOne =
            from n in numbers
            select n + 1;
        Console.WriteLine("Numbers + 1:");
        foreach (var i in numsPlusOne) {
    Code (Text):

    public void Linq88() {
       List products = GetProductList();

       var categories =
          from p in products
          group p by p.Category into g
          from maxPrice = g.Group.Max(p => p.UnitPrice)
          select new {Category = g.Key, MostExpensiveProducts = g.Group.Where(p => p.UnitPrice == maxPrice)};

       ObjectDumper.Write(categories, 1);
    Some more examples at: http://msdn2.microsoft.com/en-us/vcsharp/aa336747.aspx

    The LINQ Project: http://msdn2.microsoft.com/en-us/netframework/aa904594.aspx

    You can download a CTP version of Visual Studio Orcas (the next Visual Studio release), which includes .NET 3.5 and allows you to develop with LINQ.

    This is a new direction for OO languages and independently of whether it will be a success or a failure (personally i think it's a great idea) it's important to keep up with the times.
    Last edited by a moderator: Apr 22, 2017
  2. jcsd
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted