Introduction
Anonymous type does not contain any name but it implements the methods. Anonymous type is a class type which gets to known about the type of data at the time of compile only. Declaration of variables of anonymous data type is mandatory otherwise it will raise error. Var keyword is used to represent Anonymous type.
Syntax for Anonymous Type
Var q1=(“ from X in x select data field where condition”).First();
Ex
Var Q1=(“ From Emp in x select Emp where eid=Convert.ToInt2(TxtEid.Text)).First();
Implementing Anonymous Data Type in MVC to work with LINQ TO SQL
Step 1: Go to Visual Studio and select New project as in the following figure:

After selecting, New Project windows will appear. Now, after selecting Windows from installed template select Windows Forms Application and write the Application name, then click on Ok button.

After clicking on Ok button, go to solution explorer and click with right mouse button to Application and then select Add and New Item. After that select LINQ to SQL Classes from Add New Item window. After selecting LINQ to SQL Classes write with extension of dbml. Click on Add button as in the following figure:

After clicking on Add button go to Server Explorer and establish the connection as in the following figure:

After establishing the connection select the table and drop to DataClass1.dbml as in the following figure:

Go to Form design and design the form, then go to form.cs and write the following code,

Humayun Kabir MamunPosted Jan 24, 2016, 10:58 PM
Nice...
Afzaal Ahmad ZeeshanPosted Jan 23, 2016, 2:21 AM
"var" is not anonymous type. Who told you that? "var" is just used to implicitly convert the returned data type to "whatever" compiler thinks should be the type. Anonymous types are something else, which this article does not cover, sadly.
Santhakumar MunuswamyPosted Jan 23, 2016, 1:38 AM
Thanks for nice share
Jaco ZwartsPosted Jan 22, 2016, 11:46 AM
Nice Article!!!!