Using LINQ for the first time, for real

· September 12, 2008

The LINQ project is one of those techniques that first makes you cheer, then think about how you’ll ever will use it in real life and then not think about it.

Also it seems to be a lot of confusion about what LINQ really is. LINQ is a number of constructs in the .NET framework to do queries over database, XML or object. This post may clarify things a bit.

I ran into a situation where my function received a parameter, lista, that was Generic list of MyObject. Since I was planning on sending associative arrays to Oracle I needed each property in MyObject in an own array.

LINQ to the fore! A LINQ-query could actually help us to produce the arrays we need. Here is my code: public sub CallStoredProc(byval lista as List(Of MyObject)) Dim ids = From obj in lista Select obj.ID

end sub

My first LINQ. Me so proud! ;)

Twitter, Facebook