我在 VB6 中有以下代码:
Dim frpdReport() As REPORTDEF
For iCounter = 0 To UBound(frpdReport)
With frpdReport(iCounter)
If .iReportID = iReportID Then
fGetReportFile = .tReportFile
End If
End With
Next iCounter
我转换成这个 C# 代码:
REPORTDEF[] frpdReport = new REPORTDEF[6];
for (iCounter = 0; iCounter < Convert.ToInt32(frpdReport[6]); iCounter++)
{
if (frpdReport[iCounter].iReportID == iReportID)
{
fGetReportFile_return = frpdReport[iCounter].tReportFile;
}
}
return fGetReportFile_return;
调试时,我在 for 语句中收到以下错误 - “索引超出了数组的范围。” 而且我不知道为什么,因为数组的索引是 6。
请问有什么帮助吗?