我正在尝试向Append
类型添加System.Generics.Collections.TArray
方法。
unit uMyArray;
interface
uses
System.Generics.Collections;
type
TArray = class(System.Generics.Collections.TArray)
public
class procedure Append<T>(var AValues: array of T; const AItem: T); static;
end;
implementation
class procedure TArray.Append<T>(var AValues: array of T; const AItem: T);
begin
SetLength(AValues,Length(AValues) + 1);
AValues[Length(AValues) - 1] := AItem;
end;
end.
在编译时,在SetLength
行上出现以下错误:
[dcc32错误] uMyArray.pas(18):E2008不兼容的类型