Linq查詢之多個排序條件

hhw199112發表於2018-06-21
            Student[] stuArray =
            {
                new Student("chandler",20,"男"),
                new Student("joe",39,"男"),
                new Student("rose",38,"男"),
                new Student("monica",28,"女"),
                new Student("rachel",27,"女"),
                new Student("phobee",27,"女")

            };

            var query = from st in stuArray orderby st.Name.Length, st.Age ascending select st;
            foreach (var item in query)
            {
                Console.WriteLine(item.ToString());
            }

相關文章