Summary
BeginArray method is a low-level method, which allows to serialize array like data manually. Every call to BeginArray method should be matched by a call to NG.Serialization.TSerializer.EndArray method.
Syntax
procedure BeginArray(const AElemName: string); overload;
Parameters
- AElemName
Type: string
Specified element name for array element values, which is used to name array element values in some human readable output formats. For example, TXmlSerializer uses this string as a tag for array element nodes.
Remarks
To serialize array data, usually there are no need to use BeginArray method, the real Delphi array can be serialized using a single call to Value method:
| Delphi | Copy Code
|
|---|---|
S.Value<TMyArray>(MyArray); | |
- Calling Value method.
- Calling NG.Serialization.TSerializer.Null method, if element value is Null.
- Calling NG.Serialization.TSerializer.BeginObject(string,Boolean)/NG.Serialization.TSerializer.EndObject methods, if element value is an object.
- Calling BeginArray/NG.Serialization.TSerializer.EndArray methods, if element value is an array itself.
Examples
| Delphi | Copy Code
|
|---|---|
S.BeginArray('Number');
S.Value<Integer>(1);
S.Value<Integer>(1);S.Value<Integer>(2);
S.Value<Integer>(3);
S.Value<Integer>(5);
S.EndArray; | |