protected override void Serialize(object target, XmlElementContext context) { _listBuilder?.Begin(GetValue(target), true); var content = _listBuilder?.Objects; var targetElements = XmlElementSerializer .GetElements(context.XElement, true, _rootTarget, content?.Length ?? 0)?.ToArray(); if (targetElements == null) { throw new InvalidOperationException("Serialize No Data Returned"); } if (content == null) { return; } for (var i = 0; i < content.Length; i++) { _serializer.Serialize(content[i], targetElements[i]); } _listBuilder?.End(); }
protected override void Serialize(object target, XmlElementContext context) { var realTarget = GetValue(target); if (realTarget == null) { return; } _serializer.Serialize(realTarget, context.XElement); }