Is there a way to convert 'array of const' (open array) to TValue?

Is there a way to convert 'array of const' (open array) to TValue?
For example, I want to call SysUtils.Format function using System.RTTI.Invoke which requires function arguments to be passed as TArray.
I tried

type
 TVArray = array of TVarRec;
...
  a[1] := TValue.FromArray(TypeInfo(TVArray), [TValue.From(100)]);
  System.Rtti.Invoke(@format, a, ccReg, TypeInfo(string));

but it leads to 'Invalid class typecast' when convering array values inside Invoke.

Comments

Post a Comment