用delphi7开发一个简单的com组件,在delphi下测试通过。但是使用.net调用则就出错了:Delphi:
function TStudentQuery.GetResult(index: Integer): StudentInfo;
begin
If (index>=0) and (index<Length(FRecords)) then Result := FRecords[index];
end;其中的StudentInfo是一个公开的结构:
  StudentInfo = packed record
    id: Integer;
    Name: WideString;
    Grade: Integer;
    Class_: Integer;
  end;而FRecords则是一个StudentInfo的数组:
    FRecords : array of StudentInfo;现在使用C#进行调用:
StudentInfo si;
for (int i = 0; i < count; i++)
{
    si = query.GetResult(i);结果每次都出现异常:
[code]在 System.Runtime.InteropServices.MarshalDirectiveException 中第一次偶然出现的“StuCOM_WS.DLL”类型的异常[/code]该怎样修改才能让C#正常地调用它呢?