Интересно возможно ли такое в Delphi 8 с вариантами и вызовом методов. Если взглянуть на Borland.Vcl.Variants.pas то там есть набор методов например
class function VariantHelper.FindTypeInvoke(const AType: System.Type;
const AValue: Variant; const ANames: array of string;
const AParams: array of Variant; out AResult: Variant): Boolean;
var
LMethod: MethodInfo;
I, LParamCount: Integer;
LObjArray: array of TObject;
LTypeArray: array of System.Type;
begin
// assume the worst
Result := False;
// create a param type array
LParamCount := Length(AParams);
SetLength(LObjArray, LParamCount);
SetLength(LTypeArray, LParamCount);
for I := 0 to LParamCount - 1 do
begin
LObjArray[I] := AParams[I];
LTypeArray[I] := SafeGetType(LObjArray[I]);
end;
// try to find the method
LMethod := nil;
for I := Low(ANames) to High(ANames) do
begin
// find the ARight method for the job at hand
LMethod := AType.GetMethod(ANames[I], LTypeArray);
if LMethod <> nil then
Break;
end;
// then try to invoke it
if LMethod <> nil then
try
AResult := Variant(LMethod.Invoke(AValue, LObjArray));
Result := True;
except
on E: Exception do
if LParamCount > 0 then
if AValue <> nil then
UnhandledInvokeException(E, LMethod.Name, AValue, AParams[0])
else
UnhandledInvokeException(E, LMethod.Name, AParams[0])
else
raise;
else
Result := False;
end;
end;