Amido.SystemEx.Xml.Linq.XElementExtensions.SafeGetDecimalFromElement C# (CSharp) Метод

SafeGetDecimalFromElement() публичный статический Метод

public static SafeGetDecimalFromElement ( System.Xml.Linq.XElement element, string elementName ) : decimal
element System.Xml.Linq.XElement
elementName string
Результат decimal
        public static decimal SafeGetDecimalFromElement(XElement element, string elementName)
        {
            XElement x = GetElement(element, elementName);

            decimal result;

            if (!decimal.TryParse(x.Value, out result))
            {
                throw new InvalidOperationException(string.Format("Decimal not found in element {0}.", elementName));
            }

            return result;
        }