你在这里看到错误的代码吗?我在使用INT变量的foreach循环上得到一个InvalidCastException:
Microsoft.VisualBasic.Collection oHeaders = GetFieldIdsByName(msREPORT_HEADER);
foreach (int FieldId in oHeaders)
答案 0 :(得分:2)
foreach (object FieldId in oHeaders)
{
int value = Int32.Parse(FieldId.ToString());
}
答案 1 :(得分:1)
foreach (int i in oHeaders.Cast<int>())
{
//TODO: your action here.
}