Summary

ElemAliasAttribute can be used to change the name of array elements, which will be used while serialization. It can be applied to array type itself or an array member of class/record.

Syntax

ElemAliasAttribute = class(TAliasBaseAttr);

Remarks

Array element name is not used while de-serialization, and can be even  completely ignored by some serializers, like TBinarySerializer. However, serializers such as TXmlSerializer use element name as a tags for elements XmlNodes. The default array element name, in case ElemAliasAttribute is not specified, is 'Item'.

Examples

DelphiCopyCode imageCopy Code
type
  [ElemAlias('Value')]
  TValues = array of Double;

  TMyObject = class
  public
    MinValues: TValues;
    [ElemAlias('Value')]
    MaxValues: array of Double;
  end;