我希望使用数据列表来展示用户名以及其评论和每个评论下的附件。
我有一个名为ReviewList
的用户控件用于显示评论和其中的efiles
。但是在这行代码中出现了错误(s.tblDraft.Comments),并且在下面还有一个错误:
The non-generic type 'System.Collections.IEnumerable' cannot be used with type arguments
请帮忙,有什么问题吗?
private void Displayuser()
{
var reviews =
(from s in _DataContext.tblSends
from u in _DataContext.Users
where (s.DraftId == _Draftid) && (s.ToEmailId == u.ID)
orderby u.Name
select new
{
userid = u.ID,
username = u.Name,
comments =s.tblDraft.Comments,
w = s.tblDraft.Comments.SelectMany(q => q.CommentAttaches)
}).Distinct();
DataList1.DataSource = reviews;
DataList1.DataBind();
var theReview = reviews.Single();
DisplayReviews(theReview.comments, theReview.w);
}
private void DisplayReviews(IEnumerable<Comment> comments,
IEnumerable<CommentAttach> w)
{
ReviewList reviewList = (ReviewList)DataList1.FindControl("ReviewList1");
reviewList.Comments = comments;
reviewList.CommentAttachs = w;
reviewList.DataBind();
}
IEnumerable<string>
,如果您想要一个整数的IEnumerable,您应该使用IEnumerable<int>
等。 - Joachim Isaksson