Summary

SerializableAttribute can be applied to class or record member to  specify the this member should be serialized. Like NG.Serialization.TransientAttribute it can be also applied to class or record type.

Syntax

SerializableAttribute = class(TSerlnAttr);

Remarks

By default all public and published members of classes or records are serialized. However, if a class or record has not been primarily designed for purposes of serialization, it can be marked with TransientAttribute as a whole. This will prevent all of its members from been serialized. However, if some of its members are still need to be serialized, they can be marked with SerializableAttribute explicitly.

Protected and private members are not serialized by default. Moreover, Delphi compiler does not include them in generated RTTI.  Nevertheless, they will be serialized, if marked with SerializableAttribute explicitly and included in generated RTTI using standard Delphi {$RTTI ...} directive.

It is also possible to use SerializableAttribute for whole classes or records. This case will not change anything, however, because all public and published members are already serialized by default.