protected override void Deserialize(object target, XmlElementContext context) { _listBuilder.Begin(null, false); foreach (var xElement in GetElements(false, context.XElement, -1) ?? Enumerable.Empty <XElement>()) { _listBuilder.Add(_serializer?.Deserialize(context.Original.CreateSnapshot(xElement.ToString()))); } SetValue(target, _listBuilder.End()); }
public override object ConvertBack([NotNull] IEnumerable <string> target) { _listBuilder.Begin(null, false); foreach (var content in target) { _listBuilder.Add(_baseConverter.ConvertBack(content)); } return(Argument.CheckResult(_listBuilder.End(), "List Builder Result")); }
protected override void Deserialize(object target, XmlElementContext context) { _listBuilder?.Begin(null, false); var targetElements = XmlElementSerializer.GetElements(context.XElement, false, _rootTarget, -1)?.ToArray(); if (targetElements == null) { return; } foreach (var targetElement in targetElements) { _listBuilder?.Add(_serializer.Deserialize(targetElement)); } SetValue(target, _listBuilder?.End()); }
protected override void Deserialize(object target, HeaderdFileContext context) { Argument.NotNull(context, nameof(context)); if (string.IsNullOrEmpty(_keyName)) { return; } _listBuilder?.Begin(null, false); try { foreach (var contextEnry in context.Context[_keyName]) { _listBuilder?.Add(_converter?.ConvertBack(contextEnry.Content)); } } finally { SetValue(target, _listBuilder?.End()); } }