我有一个关于 linq 的查询:
public void method()
{
var answers = Answers.GetAnswers;
var oneA = (from a in answers
where a.Questionid == "Q101b" && a.AnswerValue.Length > 0
select new QuestionInfo { userId = a.UserId, questionId = a.Questionid }).ToList();
var mumsHabits = oneA.Intersect(mothers, new UserIdEqualityComparer()).ToList();
}
在我的方法中,我试图用 answerValue 获取所有 mumsHabits 的列表,但我只得到 userid 和 questionid。
谢谢
母亲被定义为列表母亲;
答案包含“答案”,其定义为:
public partial class Answer : INotifyPropertyChanging, INotifyPropertyChanged
{
private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
private int _AnswerId;
private string _Questionid;
private int _UserId;
private string _AnswerValue;
private string _SelectionValue;
private System.DateTime _DateAnswered;
private string _Question;
private EntityRef<User> _User;
}