title: UBound Array vb6 Conversion to C#
body: <p>I have the following code in VB6:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>And I converted to this C# code:</p>
  
  <pre><code>REPORTDEF[] frpdReport = new REPORTDEF[6];
   for (iCounter = 0; iCounter &lt; Convert.ToInt32(frpdReport[6]); iCounter++)
      {
          if (frpdReport[iCounter].iReportID == iReportID)
          {
              fGetReportFile_return = frpdReport[iCounter].tReportFile;
          }
  
      }
      return fGetReportFile_return;
  </code></pre>
  
  <p>When debugging I get the following error in the for Statement - "Index was outside the bounds of the array." And I cannot figure out why since the index of the array is 6.</p>
  
  <p>Any help please?</p>