public static XElement ToXElement(this DisplayLocation Loc, XName Name) { if (Loc == null) { return(new XElement(Name, null)); } else { XElement xe = new XElement(Name, new XElement("Row", Loc.Row), new XElement("Col", Loc.Column)); return(xe); } }
public static DisplayLocation DisplayLocationOrDefault( this XElement Elem, XNamespace ns, DisplayLocation Default = null) { if (Elem == null) { return(Default); } else { int rowNx = Elem.Element(ns + "Row").IntOrDefault(0).Value; int colNx = Elem.Element(ns + "Col").IntOrDefault(0).Value; return(new DisplayLocation(rowNx, colNx)); } }