using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class PersonData { public string Name { get; set; } // 氏名 public int Height { get; set; } // 身長 public int Weight { get; set; } // 体重 public PersonData(string _name, int _height, int _weight) { Name = _name; Height = _height; Weight = _weight; } public string Output() { return (Name + "," + Height.ToString() + "," + Weight.ToString()); } } class Program { static void Main(string[] args) { PersonData[] personArray = { new PersonData("太郎", 180, 78), new PersonData("次郎", 179, 78), new PersonData("三郎", 178, 79), new PersonData("四郎", 177, 80), new PersonData("五郎", 176, 80) }; foreach (PersonData p in personArray.OrderBy(n=>n.Weight).ThenBy(n=>n.Height)) { Console.WriteLine(p.Output()); } Console.ReadKey(); } } }