score:0

Accepted answer

project out the property you want with .select(x => x.myprop);

return fatcaquestionaires.select(x => x.questionaire).tolist();

score:1

change select to where as i mentioned in my comment. select will just return a bool value for every entry's evaluation base on your lambda expression. so you end up with a list<bool>

 var fatcaquestionaires = context.fatcaquestionaires
    .where(p => p.contactid == contactid)
    .select(q=>q.questionaire).tolist();
 return fatcaquestionaires;

score:2

what you have written looks like it will return a list of booleans and not compile. what you need is a combination of a where clause and a select clause.

return context.fatcaquestionaires
    .where(p => p.contactid == contactid)
    .select(p => p.questionaire).tolist();

where() is what limits the factaquesntionaires, and select() is where you choose the property to return. you can also write it like this:

return (from p in context.fatcaquestionaires
        where p.contactid == contactid
        select p.questionaire).tolist();

score:4

you almost have it. select invokes a transformation function, so it is just making a list of bool. you need a where clause to do the filtering, and then a select.

var fatcaquestionaires = context.fatcaquestionaires
                        .where(p => p.contactid == contactid)
                        .select(p => p.quentionaire);

return fatcaquestionaires.tolist();

score:6

using linq, first you can do a where filtering the desired rows, and then select to projecting only questionaire properties.

try this

return context.fatcaquestionaires
    .where(p => p.contactid == contactid)
    .select(p => p.questionaire)
    .tolist();

Related Query

More Query from same tag