この私のリポジトリ内の私の方法:LINQ:このLINQクエリでエラーが発生するのはなぜですか?
public List<Question> getallquestion()
{
var hej = from Core in db.CoreValue
join Question in db.Question on Core.CID equals question.QID
join Subject in db.SubjectType on Core.CID equals Subject.SID
select new
{
Core.Cname,
Question.QuestionText,
Subject.Sname
};
return hej.ToList();
}
これは誤りである:このエラーの解決策である
Cannot implicitly convert type 'System.Collections.Generic.List<AnonymousType#1>' to 'NKI3.Models.Question'
何?事前に
public class CreateViewModel
{
public string QuestionText { get; set; }
public string Sname { get; set; }
public string Cname {get;set;}
}
}
ありがとう:私はそれ
マイCreateViewModelを見つけるように見えるカント!
よろしく!
を使用し、私はそれを変更したときに、私は今、別のエラーを得た 'Question'クラス – sll