/// <summary> /// Get an attribute as double from the top of cascade only /// </summary> public double GetDoubleFromTop(string name, double defaultValue) { double retVal = defaultValue; var strVal = GetPropertyFromTop(name); if (!string.IsNullOrEmpty(strVal)) { retVal = DoubleWithUnitParser.Parse(strVal); } return(retVal); }
/// <summary> /// Converts the specified attribute to a double value /// </summary> private double GetDoubleAttribute(XElement element, string name, double defaultValue) { double retVal = defaultValue; XAttribute xAttr = element.Attribute(name); if (xAttr != null) { var dblStr = xAttr.Value; retVal = DoubleWithUnitParser.Parse(dblStr); } return(retVal); }