public string ToXML() { // <![CDATA[...]]> StringBuilder sb = new StringBuilder(); sb.AppendLine($"<repository name=\"{Name}\">"); sb.AppendLine($"<description><![CDATA[{Description}]]></description>"); sb.AppendLine($"<url><![CDATA[{URL}]]></url>"); sb.AppendLine("<files>"); if (Files?.Count() > 0) { foreach (var file in Files) { sb.AppendLine(file.ToXML()); } } sb.AppendLine("</files>"); if (Miscellaneous?.Any() == true) { sb.AppendLine("<miscellaneous>"); foreach (var item in Miscellaneous) { sb.AppendLine(item.ToXML()); } sb.AppendLine("</miscellaneous>"); } sb.AppendLine("</repository>"); return(sb.ToString()); }