Chinaunix首页 | 论坛 | 博客
  • 博客访问: 815817
  • 博文数量: 101
  • 博客积分: 1311
  • 博客等级: 中尉
  • 技术积分: 1191
  • 用 户 组: 普通用户
  • 注册时间: 2009-07-25 12:15
文章分类

全部博文(101)

文章存档

2012年(101)

分类: 嵌入式

2012-06-12 23:32:23

未处理的“System.InvalidCastException”类型的异常出现在 mscorlib.dll 中。

其他信息: At least one element in the source array could not be cast down to the destination array type.

代码:

public ArrayList arr_column = new ArrayList();

StringBuilder column_attr = new StringBuilder();

foreach (XmlElement column in table.SelectNodes("c:Columns/o:Column/*[ name() = 'a:Name' or name() = 'a:Code' or name() = 'a:Comment']", namespaceManager))

{

column_attr.Append(column.InnerText);

}

arr_column.Add(column_attr.tostring()); //必须在导入到arraylist时把StringBuilder转换为String ;

arr_one.AddRange(arr);

arr_one.AddRange(arr_column);

String[] arr_str = arr_one.ToArray(typeof(string)) as string[];

return arr_str;

阅读(2317) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~