Threadlist of TObject with Delphi - How to populate?
问题 From my limited knowledge about this subject, the following code should work. But I have not the expected result: type TClient = class(TObject) Host: String; end; var Clients: TThreadList; const Hosts: Array[0..5] of String = ('HOST1', 'HOST2', 'HOST3', 'HOST4', 'HOST5', 'HOST6'); var I: Integer; List: TList; Client: TClient; begin try for I := Low(Hosts) to High(Hosts) do begin Client := TClient.Create; with Client Do try Host := Hosts[I]; List := Clients.LockList; try Clients.Add(Client);