LINQ, DLINQ and XLINQ

LINQ, DLINQ and XLINQ

 

It’s been while since PDC where I heard about the LINQ stuff.  I was always had an ambitions to learn about things.  So from the very first day I read a Blog about LINQ I always tried to get the stuff to read about it.  At that time information was not made available by Microsoft.  But now Tons of data has been shared at many places.  But I wanted to kick start this thing from some video stuff so that I can have the working idea about the thing called LINQ. 

LINQ

Using SQL statement to collect data from the SQL server is a general practice done by almost every developer.  But after collecting data from server into some arrays or object types.  We don’t have much control on it so that we can manipulate that data just like we do in SQL server.  Good thing is LINQ language integrated Query is a concept in which Microsoft has merged SQL with the language.  Now System. Query is another namespace that has all the extended function we can use to use SQL methods inside our array list and objects.  Now we can write our queries on the data collected within the objects and array lists.  We can perform LINQ function on every thing that implements IENumerable of T.  LINQ is language or interface independent that means we can get any thing from anything.  For example we can get all the button from a windows form and can disable them using the same query.  I am writing the sample code here as my head works.  Please note that I never had tried any code using LINQ sure will download the runtimes for LINQ but what I am writing below is all from my head.

 

Var Names = new String = {“Yasir,”Attiq”,”Butt”}

 

Var p = from AllName in Names

            Where  Names

            Select AllName

And use foreach statement to extract name from P

Foreach (var Name in Names)

{

            Console.writeline(Name);

}

This will Return “Yasir”,”Attiq”,”Butt”

Or you can try this as well

Var q = from aName in Names

            Where Names.startsWith(“Y”)

            Select aName

 

This will Return “Yasir”

 

As I mentioned above if you wanted to extract the member of a class or methods of an assembly we can use LINQ.  We don’t have to use reflection method for this.  See the sample Below

 

Var strMethods = from strValues from Typeof(String)

                          Where a.GetMethods()

                        Select strValues

 

 

Foreach (String strMethod in strMethods)

{

            Console.writeline(strMethod);

}

DLINQ

DLINQ is a the future of ADO.Net.  It will be used to generate the queries same as SQL Statement directly into our code.

 

XLINQ

XLINQ is used for the SQL maniplulation of XML Data.  We can create any XML Element and child element using the new XLINQ Methods.

 

Overall I found LINQ very help full.  I learned that it will be available in C# 3.0 and VB.Net 9.0.  The LINQ code snippits are available for download at Microsoft.com/future.

 

Well Done Microsoft

 

Jerry

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s