コード例 #1
0
        /// <summary>
        /// A list of students ordered by their number grade descending (Grade - FirstName LastName)
        /// </summary>
        /// <returns></returns>
        private List <StudentGradeVM> GetStudentsNumberGradeDesc()
        {
            var anony = GradeList.OrderByDescending(g => g.NumberGrade).ThenByDescending(g => g.FirstName).ThenByDescending(g => g.LastName).Select(b => new { b.NumberGrade, b.FirstName, b.LastName });

            List <StudentGradeVM> listvm = new List <StudentGradeVM>();

            foreach (var zz in anony.ToList())
            {
                listvm.Add(new StudentGradeVM {
                    NumberGrade = zz.NumberGrade, FirstName = zz.FirstName, LastName = zz.LastName
                });
            }

            return(listvm);
        }