Use of Var Type

Rajesh_Kumar
Posted by Rajesh_Kumar under LINQ category on | Points: 40 | Views : 686
When we do not know the type of output,then we use var type.Suppose we are joining two tables and retrieving data from both the tables then the result will be an Anonymous type i.e. var type.

var q =(from e in employee_master
join p in project_master on e.supervisor_id equals p.employee_id
select new
{
e.emp_id,
e.emp_full_name,
e.emp_address,
e.emp_contact_number,
p.project_id,
p.project_name
});

Comments or Responses

Login to post response