/// <inheritdoc/> public void WriteProperty(ISerializableWithWriter value) { if (value != null) { value.Serialize(this); } }
/// <inheritdoc/> public void WriteProperty(string name, ISerializableWithWriter value) { if (value != null) { this.WriteStartObject(name); value.Serialize(this); this.WriteEndObject(); } }
public void WriteProperty(ISerializableWithWriter value) { if (value != null) { this.lastPrefix.Push(this.currentPrefix); this.currentPrefix = this.GenerateSequencialPrefix(); value.Serialize(this); this.currentPrefix = this.lastPrefix.Pop(); } // Generated name would not indicate which object is missing value. No entry is added to accumulated dictionary }
public void WriteProperty(string name, ISerializableWithWriter value) { if (string.IsNullOrEmpty(name)) { throw new ArgumentException("This argument requires a non-empty value", nameof(name)); } if (value != null) { this.lastPrefix.Push(this.currentPrefix); this.currentPrefix = this.GetKey(name); value.Serialize(this); this.currentPrefix = this.lastPrefix.Pop(); } else { this.WriteProperty(this.GetKey(name), (string)null); } }