using System.IO; using System.Text; using System.Xml; namespace AIPractice.Shared.Labels { public class DescriptionLabel: ImageLabel { public DescriptionLabel(string id, string title) : base(id, title) { } public static DescriptionLabel FromXml(string xmlContent) { using (var ms = new MemoryStream(Encoding.Unicode.GetBytes(xmlContent))) { using (var r = XmlReader.Create(ms)) { r.Read(); var id = r.GetAttribute("id"); var title = r.GetAttribute("title"); return new DescriptionLabel(id, title); } } } public override string ToXml() { return $"<{nameof(DescriptionLabel)} id=\"{Id}\" title=\"{Title}\"/>"; } } }