具体如下图:
解决方案
10
你的
Array m = Array.CreateInstance(typeof(people), 5); m.SetValue(new people("p1", 22), 0); m.SetValue(new people("p2", 12), 1); m.SetValue(new people("p3", 2), 2); m.SetValue(new people("p4", 10), 3); m.SetValue(new people("p5", 10), 4);
写法没见过,看着怪累的
改成这样就什么问题都没有
var m = new people[] { new people("p5", 22), new people("p4", 12), new people("p3", 2), new people("p2", 10), new people("p1", 10) };
15
不要用数组了,用集合试试
List<people> peopleList = new List<people>();
peopleList.Add();//你的实例
peopleList.OrderBy(peoplename)
List<people> peopleList = new List<people>();
peopleList.Add();//你的实例
peopleList.OrderBy(peoplename)
15
人家都提示要实现IComparable了,你哪里实现IComparable了?