Summary
Abstract Read method should be overridden by the user. The implementation of the method should use D de-serializer public methods to de-serialize V value.
Syntax
procedure Read(D: TDeserializer; var V); virtual; abstract;
Parameters
- D
Type: TDeserializer
De-serializer, which public methods is used by the converter to read V value.- V
Type: Void Type
Resulting de-serialized value.
Remarks
Note: |
---|
If converter work in fill-read mode, the V should be treated as constant and its value should not be changed. For more information about fill-read mode look at NG.Serialization.FillReadAttribute description. |
Examples
Delphi | Copy Code |
---|---|
procedure TMyPointConverter.Read(D: TDeserializer; var V); var str: string; begin str := D.Value<string>; TPoint(V) := ParsePoint(str); end; |
Delphi | Copy Code |
---|---|
procedure TMyCollectionConverter.Read(D: TDeserializer; var V); var c: TMyCollection; itm: TMyItem; begin // Work in fill-read mode, no new // collection instance created. c := TMyCollection(V); D.BeginArray; c.Clear; while D.HasNext do begin // Again, work with items in fill-read // mode. Add an empty item into collection // first, then fill it using de-serializer. itm := c.Add; D.Value<TMyItem>(itm); end; D.EndArray; end; |