【发布时间】:2014-04-12 04:01:58
【问题描述】:
这是我的对象类:
public class personSerialize
{
public string[] name { get; set; }
public int number { get; set; }
};
而对象创建代码为:
personSerialize personObject = new personSerialize()
{
name = people, //'people' is an ArrayList BTW
number = peopleNum
};
它返回一个错误:
无法将类型“System.Collections.ArrayList”隐式转换为“string[]”
我知道 '[]' 不是 ArrayList,但我不知道还能说什么。谢谢
【问题讨论】:
-
试试 ->
name = (string[]) people.ToArray()