已知一个type类型,如何获得它的的数组形式的type
在做xml序列化时,通过参数得到一个type,如何得到它的数组类型的Type实例
void ser(Type type)
{
// 通过type获得等价于下面的数据
//var t2 = typeof(xxx[])
}
...
ser(typeof(xxx));
基础 反射
[解决办法]
var t2 = type.MakeArrayType();
string[10] arr = Array.CreateInstance(typeof(string),10);