111,129
社区成员
发帖
与我相关
我的任务
分享 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)
};