开发者

How to group select new GetTable<>?

开发者 https://www.devze.com 2023-02-22 09:59 出处:网络
DataContext db = new DataContext(conString); var dvd = db.GetTable<DvdList>(); var query = from b in dvd
DataContext db = new DataContext(conString);
var dvd = db.GetTable<DvdList>();
var query = from b in dvd
            group b by b.CategoryId into g
            select new { CategoryId = g.Key, GetTable<DvdList>()= g };

The error occurs at 开发者_如何学编程GetTable<DvdList>()= g


Your syntax makes no sense whatsoever.

If you just want the contents of the group, you don't need a select clause at all; the group clause returns a set of IGrouping<String, DvdList> that is itself a set of DVDs.


GetTable<DvdList>()= g is syntactically invalid. The left side declares the name of the property in the anonymous type that is created. <, >, ( and ) are invalid characters inside the name of a property.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号