public XmlNode ToXml(XmlDocument doc) { XmlNode functionNode = doc.CreateElement("FunctionLayer"); XmlAttribute nameAttribute = doc.CreateAttribute("Name"); nameAttribute.Value = _name; XmlAttribute aliasAttribute = doc.CreateAttribute("AliasName"); aliasAttribute.Value = _aliasName; XmlAttribute visibleAttribute = doc.CreateAttribute("Visible"); visibleAttribute.Value = _visible.ToString(); XmlAttribute typeAttribute = doc.CreateAttribute("Type"); typeAttribute.Value = EnumHelper.ConvertFunctionLayerTypeToString(_functionType); functionNode.Attributes.Append(nameAttribute); functionNode.Attributes.Append(aliasAttribute); functionNode.Attributes.Append(visibleAttribute); functionNode.Attributes.Append(typeAttribute); XmlNode fieldsNode = doc.CreateElement("Fields"); foreach (IYTField ytField in _fields) { fieldsNode.AppendChild(ytField.ToXml(doc)); } functionNode.AppendChild(fieldsNode); return(functionNode); }