本文介绍了在linq中选择计数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 嘿 以下查询我想得到一个问题答案的数量 ( from sq in context.TblStudentQues > join asq context.TblAnswerStudentQues on sq.IDstques等于asq.IDMaster join u in context.TblUsers on sq.IDUser equals u.IDUser group asq by asq.ID into cc select new {u.FamilyName,cc.Count()})。ToList(); 我的代码不起作用。为什么?解决方案 尝试以下链接: http://stackoverflow.com/questions/7012495/linq-query-to-count-field-in-datatable [ ^ ] http:// msdn .microsoft.com / zh-cn / library / vstudio / bb397906.aspx [ ^ ] ( from context.TblStudentQues join asq in context.TblAnswerStudentQues on sq.IDs tques等于asq.IDMaster join u 在 context.TblUsers on sq.IDUser equals u。 IDUser group asq by asq.ID into cc 选择 new {asq.ID,cc.Count()})。ToList(); heyin below query i want to get count of answer to a question(from sq in context.TblStudentQues join asq in context.TblAnswerStudentQues on sq.IDstques equals asq.IDMaster join u in context.TblUsers on sq.IDUser equals u.IDUser group asq by asq.ID into cc select new {u.FamilyName,cc.Count() }).ToList();my code doesn't work . why ? 解决方案 try the following link:http://stackoverflow.com/questions/7012495/linq-query-to-count-field-in-datatable[^]http://msdn.microsoft.com/en-us/library/vstudio/bb397906.aspx[^](from sq in context.TblStudentQues join asq in context.TblAnswerStudentQues on sq.IDstques equals asq.IDMaster join u in context.TblUsers on sq.IDUser equals u.IDUser group asq by asq.ID into cc select new {asq.ID,cc.Count() }).ToList(); 这篇关于在linq中选择计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-10 21:51