, 나는 일반적인 TInterfaceList을 정의했습니다 :Delphi의 일반적인 TInterfaceList가 가능합니까? 다음과 같이 델파이 2010 년
type
TInterfaceList<I: IInterface> = class(TInterfaceList)
function GetI(index: Integer): I;
procedure PutI(index: Integer; const Item: I);
property Items[index: Integer]: I read GetI write PutI; default;
end;
implementation
function TInterfaceList<I>.GetI(index: Integer): I;
begin
result := I(inherited Get(Index));
end;
procedure TInterfaceList<I>.PutI(index: Integer; const Item: I);
begin
inherited Add(Item);
end;
내가 아직 문제가 없었어요,하지만 아무것도 본질적으로이 일에 대한 위험이 있습니까? 그것이 for..in 루프가 작동하도록 열거자를 추가 할 수 있습니까? 거기에 아무 문제가 없다면 왜 비슷한 것이 아직 RTL에 정의되어 있지 않은지 궁금합니다.