Summary

Abstract Write method should be overridden by the user. The implementation of the procedure should use S serializer public methods to serialize provided V value.

Syntax

procedure Write(S: TSerializer; const V); virtual; abstract;

Parameters

S

Type: TSerializer

Serializer, which public methods is used by the converter to write V value.
V

Type: Void Type

Serializing value.

Examples

DelphiCopyCode imageCopy Code
procedure TMyPointConverter.Write(S: TSerializer; const V);
var
  str: string;
begin
  str := IntToStr(TPoint(V).X) + ',' + IntToStr(TPoint(V).Y);
  S.Value<string>(str);
end;
DelphiCopyCode imageCopy Code
procedure TMyCollectionConverter.Write(S: TSerializer; const V);
var
  i: Integer;
  c: TMyCollection;
begin
  c := TMyCollection(V);
  S.BeginArray('Item');
  for i := 0 to c.Count - 1 do
    S.Value<TMyItem>(c.Items[i]);
  S.EndArray;
end;

See Also