public static T Get <T>(this XmlElement thisValue, [NotNull] string name, T defaultValue) { if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException(nameof(name)); } if (!IsValid(thisValue)) { return(defaultValue); } if (thisValue.HasAttributes) { XmlAttribute attribute = thisValue.Attributes[name]; if (attribute != null) { return(attribute.Get(defaultValue)); } } XmlElement child = thisValue.Select <XmlElement>(name); return(child == null ? defaultValue : child.InnerText.To(defaultValue)); }