0

I'm trying this way, however the size remains 0

  v := _RttiFld.GetValue(obj);
  P := v.GetReferenceToRawData;
  idx := 2; //to test
  DynArraySetLength(p,v.TypeInfo,1,@idx);
  Assert(_RttiFld.GetValue(obj).GetArrayLength > 0);

My field is a dynamic array of string

FMensage : array of string;
drgarcia1986
  • 343
  • 1
  • 5
  • Do you really need to set the length of a dynamic array like this? You can use `SetLength` you know. – Bogdan Doicin Feb 17 '13 at 08:17
  • The answer given at this question: [how to set array length with delphi 2010 rtti](http://stackoverflow.com/a/1770571/576719) is wrong. I made a comment to notify the author. – LU RD Feb 17 '13 at 08:39
  • And here is dupe number three: [Delphi: how to set the length of a RTTI-accessed dynamic array using DynArraySetLength?](http://stackoverflow.com/q/2528732/576719). – LU RD Feb 17 '13 at 09:12
  • @DavidHeffernan why would anydbody use RTTI for this? Don't we have `SetLength`? – Bogdan Doicin Feb 17 '13 at 12:39
  • @Bogdan if I could use setlength have used. The complete code performs a process with generic data serialization using rtti – drgarcia1986 Feb 17 '13 at 18:25

0 Answers0