score:17

Accepted answer

you can do it with a middle-step by selecting an anonymous type:

db.resource.select(x => new { x.resource_id, x.name }).asenumerable().select(x => tuple.create(x.resource_id, x.name)).tolist();

creating a tuple is not a supported operation in linq to entities, so you have to select an anonymous type, which would be an equivalent to:

select [resource].[resource_id], [resource].[name]

then move to linq to objects by asenumerable and get your tuple.

score:2

you can create a list from db.resource and use linq to collections to erase this limitation:

var list = db.resource.tolist().select(res => tuple.create(res.resource_id, res.name));

the tuple class does have some constructors (up to 8 items), but the create() helper method makes the creation more straightforward.


Related Query

More Query from same tag