Follow ITProPortal:

RSS Tweet Digg

Comparing Linq and SQL

Prove you're a Dev Guru! Take the test now!

Linq ('Language Integrated Query') is a Microsoft programming model that adds formal data querying capabilities to .NET-compliant languages. You can project, filter and traverse data in arrays, enumerable classes and relational databases using native .NET language syntax for queries. To see Linq at work, take a look at the following example:

 using System;

using System.Linq;

using System.Collections.Generic;

 class MyLinqApp

{

  static void Main()

  {

      string[] myData = { "Microsoft", "IBM", "Intel", "Sun Microsystems", "AMD" };

      IEnumerable<string> myLinqQuery = from data in myData

                                                                  where data.Length < 4

                                                                  orderby data

                                                                select data.ToUpper();

      foreach (string data in myLinqQuery)

      Console.WriteLine(data);

   }

}



blog comments powered by Disqus

ITProPortal.com monitors all leading technology stories and rounds them up to help you save time hunting them down.

Follow ITProPortal:

RSS Tweet Digg

Owned &
operated by:

Net Communities