tags:

views:

58

answers:

1

Hi

How do I select multiple columns in linq to sql method syntax? I only know how to select one column but not multiple columns.

Like if I had a this table

ProductId
ProductName
ProductQty
ProductNumber

How could I select productName and ProductQty but not ProductNumber or ProductId in linq to sql method syntax?

+5  A: 

something like this:

from item in db.products
select new {item.ProductName, item.ProductQty};

or

db.products.Select( item => new {item.ProductName, item.ProductQty} );
Aziz
I want to know it in method syntax. Ie Entity.Where(....).Select(....);
chobo2