Summary

BeginArray method is a low-level method, which allows to de-serialize array like data manually. Every call to BeginArray method should be matched by a call to NG.Serialization.TDeserializer.EndArray method.

Syntax

procedure BeginArray;

Remarks

To de-serialize array data, usually there are no need to use BeginArray method, the real Delphi array can be de-serialized using a single call to Value method:

DelphiCopyCode imageCopy Code
MyArray := S.Value<TMyArray>;
However, there are cases, when the data is not physically stored in array. In such cases its possible to de-serialize array like data manually, using BeginArray/NG.Serialization.TDeserializer.EndArray low-level methods. After a call to BeginArray, all array elements should be read one by one; when array elements was read, a call to NG.Serialization.TDeserializer.EndArray must be made.  An array element can be read using one of the following ways:

Examples

DelphiCopyCode imageCopy Code
D.BeginArray;
while D.HasNext do
  MyIntList.Add(D.Value<Integer>);
D.EndArray;