Posted By: scobleizer | Sep 13th, 2005 @ 11:27 AM | 339,857 Views | 89 Comments
LINQ stands for Language INtegrated Query and in a nutshell, it makes query and set operations, like SQL statements first class citizens in .NET languages like C# and VB.

Here we visit Anders Hejlsberg in his office to get more on LINQ. Dan Fernandez, also seen in this video, just put up a blog post about LINQ.
Media Downloads:
Rating:
2
0
that is the most amazing thing I've seen in a long time. 

now I know what the WinFS docs were talking about when they said C# 3.0's integrated query would be supported for querying WinFS stores.

Wow Expressionless
Does ths not look like FoxPro? Where you can intermingle SQL with structure code in your source file? And get SQL extracts right into local vars?
Is it just me or are we back some 15 years' time?

NateFurtwangler
NateFurtwangler
www.n​atefurtwangler.c​om
Amazing stuff, looks like it will be very useful and thats coming from someone who has to work with SQL every day.
Tyler Brown
Tyler Brown
Bullets change governments far surer than votes.
Great video! Amazing being able to run these queries on generics, databases, or even XML! This will be so useful. Its such a more natural way of thinking about selecting and sorting your data. Seems so much powerful as well. I must admit that the inverted SQL style language is somewhat odd at first, but by the end of the video it just seems so natural.
bobEnglish wrote:

Wow
Does ths not look like FoxPro? Where you can intermingle SQL with structure code in your source file? And get SQL extracts right into local vars?
Is it just me or are we back some 15 years' time?



No, FoxPro was 15 year ahead of it's time. Wink

A lot of the functions remind me of Ruby blocks and iterators. Don Box did a series on implementing Ruby continuations in C# 2.0 a while back that was fascinating.
AWESOME, well this will take C# to the next level....Anders did it once again.

Heey does this mean we can pull data from database or xml quicker?
staceyw
staceyw
Before C# there was darkness...
OMG.  That hits the mark in sooo many ways.  The power of this is mind blowing.  Anders (et al) rocks.  Hats off to C9 also. You promised this last time and you did it!  It amazing to think of the work that went on between then and now to get those bits ready.  Anders must have been further along then he let on last time.

BTW, what was the "var" class (i.e. "var q = new...")?  I expect the Monad folks wish they had this a year ago.  I suppose they must shred this into their code now for all the object query stuff they do.
 
Now all anyone has to do is implement an LINQ Object Provider (LOP) around their data and Bingo, instant user query access.

Hmm...: fat, ntfs, AD, exchange, winfs, machine config, registry, perf counters, net config, hardware info.  The list is endless.

Something like this would be way cool to be able to do some day:

var q = From Microsoft.LINQProviders.AD
Select WindowsIdentity
Where Username == "billg" && Domain == "MS"

WindowsIdentity wi = (WindowsIdentity)q[0];
WindowsPrinciple wp = new WindowsPrinciple(wi);

if ( wp.TryLogon("password") )
   Console.WriteLine("Logon good.");
else
{
  Console.WriteLine("Could not authenticate.");
  return false;
}

Console.WriteLine("billg is an Admin:"+wp.IsInRole("Admins"));

using(Impersonate i = new Impersonate(wp))
{
       File.Delete(@"c:\Linix\*.*"); // Wink
}


Very cool indeed.  Pizza and beer for the team! Smiley

--William Stacey [MVP]

the 'var' identifier isn't a class, but rather a C# 3.0 (i think) keyword that tells the compiler that you want the type of q to be determined by how it's used.

so:

var i = someArray.Length; //i is an int

but

var i = 1.0; //i is a double

var i = {Name = "BillG", Title = "Chief Architect"}; //i is an anonymous type with string's Name & Title

pretty niffty if you ask me.  very similar to python actually where you dont have to declare the type because it just gets inferred by how its used.  I like it!
Microsoft Communities