foreach 遍历object数组

heefan heefan 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区


//get excel A1 ~ A26 cells' data
Excel.Range ColumnOne = xlsworksheet.get_Range("A1","A5");

foreach (object element in ColumnOne.Value2)
{
// I wanna do something here
}

Error:
foreach statement cannot operate on variables of type 'object' because 'object' does not contain a public definition for 'GetEnumerator'

ColumnOne.Value2的定义及数值
Value2 {object[1..5, 1..1]}

[1,1]= null
[2,1]= Hello
[3,1] = null
[4,1] = 123
[5,1] = 1.224

foreach 如何遍历这个数组?
...全文

相关推荐

评论 5
收藏 已收藏
分享
返回顶部
heefan
C# 111,129 成员 642,539 内容