【发布时间】:2021-05-03 22:26:27
【问题描述】:
我需要 LINQ 方面的帮助,我需要根据计算出的平均水平对学生列表进行分组 有一个学生班:
public class Student
{
public string Name { get; set; } // student name
public int[] Scores { get; set; } // test scores
}
我有一份包含数据的学生列表
List<Student> students = new List<Student>
{
new Student { Name = "Michael", Scores = new int[] { 94, 92, 91, 91 } },
new Student { Name = "Isabelle", Scores = new int[] { 66, 87, 65, 93, 86} },
new Student { Name = "Chastity", Scores = new int[] { 76, 61, 73, 66, 54} },
new Student { Name = "Chaim", Scores = new int[] { 94, 55, 82, 62, 52} },
new Student { Name = "Patience", Scores = new int[] { 91, 79, 58, 63, 55} },
new Student { Name = "Echo", Scores = new int[] { 74, 85, 73, 75, 86} },
new Student { Name = "Pamela", Scores = new int[] { 73, 64, 53, 72, 68} },
new Student { Name = "Anne", Scores = new int[] { 78, 96, 52, 79, 60} },
new Student { Name = "Fuller", Scores = new int[] { 59, 68, 88, 85, 76} },
new Student { Name = "Cameron", Scores = new int[] { 70, 73, 75, 51, 98} },
new Student { Name = "Aurora", Scores = new int[] { 65, 70, 53, 80, 52} },
new Student { Name = "Anthony", Scores = new int[] { 68, 69, 94, 88, 98} },
}
我需要范围的括号在测试分数括号中是 10 的倍数 • 50、60、70、80、90、100
输出应如下所示:
【问题讨论】:
-
Tobit Sabu 你能澄清一下你的问题吗?
-
你是如何对数据进行排序的?
-
我刚刚添加了输出。
-
@TobitSabu 看看我的回答