德尔福:缺少运算符或分号

use*_*845 2 delphi operator-keyword

我使用的是Indy 10(TIdTcpServer),我收到以下错误:

[DCC Error] MainForm.pas(88): E2066 Missing operator or semicolon
Run Code Online (Sandbox Code Playgroud)

尝试运行此代码时:

procedure TForm1.SendMessage(Data: String; Client: Integer);
var
  List: TList;
  AContext: TIdContext;
begin
  List := idTcpServer1.Contexts.LockList;
  AContext(List[0]).Connection.IOHandler.WriteLn(Data);  // Line 88
end;
Run Code Online (Sandbox Code Playgroud)

我无法弄清楚我错过了什么; 任何帮助?

Ken*_*ite 9

虽然我无法解释您所获得的错误,但您的代码完全错误.

将其更改为:

procedure TForm1.SendMessage(Data: String; Client: Integer);
var
  List: TList;
  AContext: TIdContext;
begin
  List := idTcpServer1.Contexts.LockList;
  AContext := TIdContext(List[0]);
  AContext.Connection.IOHandler.WriteLn(Data);
end;
Run Code Online (Sandbox Code Playgroud)

您对非类型的类型转换的错误使用可能会使编译器感到困惑.如果这不能解决问题,请编辑您的问题,以便为您发布的内容添加更多代码(在您发布的内容之前,这十几行会有所帮助).