RTTI Dynamic array TValue Delphi 2010

Posted by user558126 on Stack Overflow See other posts from Stack Overflow or by user558126
Published on 2010-12-30T09:44:03Z Indexed on 2010/12/30 9:54 UTC
Read the original article Hit count: 246

Filed under:
|
|
|
|

Hello

I have a question. I am a newbie with Run Time Type Information from Delphi 2010. I need to set length to a dynamic array into a TValue. You can see the code.

Type TMyArray = array of integer;
TMyClass = class
publihed
function Do:TMyArray;
end;

function TMyClass.Do:TMyArray;
begin
SetLength(Result,5);
for i:=0 to 4 Result[i]=3;
end;
.......
.......
......
y:TValue;
Param:array of TValue;
.........
y=Methods[i].Invoke(Obj,Param);//delphi give me a DynArray type kind, is working, Param works to any functions.

if Method[i].ReturnType.TypeKind = tkDynArray then//is working...
begin
    I want to set length for y to 10000//i don't know how to write.
end;

I don't like Generics Collections.

© Stack Overflow or respective owner

Related posts about arrays

Related posts about delphi