This is dependant on which serializer you are using:
- For the JsonSerializer, use
[ScriptIgnore]
. - For the DotNetXmlSerializer, use
[System.Xml.Serialization.XmlIgnore]
.
I can't answer with certainty what attribute should be used when you use XmlSerializer but I would suspect it should be either [NonSerialized]
, [ScriptIgnore]
or [XmlIgnore]
.
Documentation: