Kapiert. Nun bekomme ich eine Fehlermeldung:
E2010 Inkompatible Typen: 'System.SysUtils.TPredicate<Unit1.TDriverList<T>.T >' und 'Procedure'
Code wie folgt:
Delphi-Quellcode:
TDriverList<T: TDriverBase> = class(TObjectList<T>)
private
protected
public
function Find(const Predicate: TPredicate<T>): T;
function FindByIMEI(AIMEI: string): T;
function FindByID(AID: string): T;
end;
[...]
{ TDriverList<T> }
function TDriverList<T>.Find(const Predicate: TPredicate<T>): T;
begin
for Result in self do
if Predicate(Result) then
exit;
Result:=nil;
end;
function TDriverList<T>.FindByID(AID: string): T;
begin
Result:=Find(
function(Obj: TDriverBase): boolean
begin
Result:=(Obj.DriverID = AID);
end); //<- Hier bleibt der Compiler stehen
end;
Ehrlich gesagt sehe ich den Fehler nicht. Find will als Param ein TPredicate und meine anonyme Methode hat doch die passenden Params?