コード例 #1
0
        public static ThemeListAuthor Load(XElement xEle)
        {
            if (xEle == null)
            {
                throw new ArgumentNullException(nameof(xEle));
            }
            if (xEle.Name != "author")
            {
                throw new ArgumentException("Invalid XElement");
            }
            ThemeListAuthor author = new ThemeListAuthor();

            foreach (XElement entry in xEle.Elements("info"))
            {
                string attributeType = (string)entry.Attribute("type");
                string value         = string.IsNullOrWhiteSpace(entry.Value) ? null : entry.Value;
                switch (attributeType)
                {
                case "Name":
                    author.Name = value;
                    break;

                case "Title":
                    author.Title = value;
                    break;

                case "Organization":
                    author.Organization = value;
                    break;

                case "Address1":
                    author.Address1 = value;
                    break;

                case "Address2":
                    author.Address2 = value;
                    break;

                case "Email":
                    author.Email = value;
                    break;

                case "Phone":
                    author.Phone = value;
                    break;
                }
            }
            return(author);
        }
コード例 #2
0
        public object Clone()
        {
            ThemeListAuthor author = (ThemeListAuthor)MemberwiseClone();

            return(author);
        }