LINQ and LinkPad – part 001.

LINQ stands for Language Integrated Query and enables us to query any type of data store, like SQL Server, XML documents, Objects in memory, etc.
You don’t need to know the syntax specific to data source because LINQ enables us to work with the different data source.
If we develop one application and this working with databases, XML documents and/or in memory objects then we can use LINQ.
LINQ query can be using any .NET supported programming language because of LINQ component between the LINQ query and the data source.
LinqPad tool can be downloaded for free from here. Now I help you to learn, write and test LINQ.
Today I will try to use C# with LinqPad.
LinqPad helps you to under C# to make it converted to Intermediate Language (IL) which is also known as Microsoft Intermediate Language or Common Intermediate Language.
If you try to use LinqPad without source code then the only error under C# will come into C# Statement  expected
Press F4 button then press Add button (Query Properties ) and type WindowsBase.dll (Add Custom Assembly References – window) then press the Ok button.
Let’s test all. Wrote this example and under Results tab click under IL.

Example 1
C# Expression

Result IL

Example 2
C# Statement

Result IL:

this can a little dizzy for you but will come with future details.

Example 3
C# Program

Results IL :

This example will show us the results over IL.
Using LinqPad with assemblies .NET.
Under C# the most simple DLL example can be:

If we wrote into LinqPad under C# Statement and then run it.

Console.WriteLine(“tutorial LinqPad -001”);
… the result will be :

The next step is to create one new file into our C# project named Test.dll with this source code:

If you parse this code you will see under call I need to add this :

This is just one simple example of LinqPad.This software’s very good when working with SQL, ASP, data, arrays.
To make the DLL file you need this: ilasm.exe
Run the command under cmd.exe:

The result will be Test.dll.
Let test it:
Make another file with notepad, named DllTest.cs and put this source code:

Use cmd.exe to compile this into EXE file format :

If you run this using cmd.exe the output will be:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.