private static IEnumerable <object> ConvertContent(TomlValue value) { switch (value.Type) { case TomlItemType.Array: foreach (var a in (IEnumerable <ArrayItem>)value.Value) { foreach (var c in a.Before) { yield return(new XComment(c.Text)); } if (a.Value != null) { yield return(new XElement("item", new XAttribute("type", XUtils.GetJsonTypeString(a.Value.Type)), new XAttribute("toml", a.Value.Type.ToString()), ConvertContent(a.Value) )); } foreach (var c in a.After) { yield return(new XComment(c.Text)); } } break; case TomlItemType.InlineTable: foreach (var n in ToXNodes((IEnumerable <KeyValue>)value.Value)) { yield return(n); } break; default: yield return(value.Value); break; } }