delphi - type casting to a dynamic array -


given following:

type   tsometypearray = array of sometype;  var   anarray: array of sometype;  function getsometypearray: tsometypearray;  

i want write anarray = getsometypearray(); compiler not it. without changing type of anarray or return type of getsometypearrayhow can typecast tsometypearray array of sometype?

you can't. need declare anarray of type tsometypearray, should work.

alternatively, store result array of type tsometypearray call setlength on anarray length of returned array. , loop through 2 arrays setting elements of anarray elements of returned array.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -