日期:2014-05-18  浏览次数:20799 次

C# 对象数组的初始化问题
student []a=new student[2]{};
student是带有string和int 这2个类型的数据成员的类
求教能不能直接像整形数组一样直接在大括弧里加数据:int []a=new int[2]{1,2};

------解决方案--------------------
student[] a = new student[]
{
new student() { Name = "aa" },
new student() { Name = "bb" }
};