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

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

public static SafeGetDecimalFromAttribute ( System.Xml.Linq.XElement element, string attributeName ) : decimal
element System.Xml.Linq.XElement
attributeName string
Результат decimal
        public static decimal SafeGetDecimalFromAttribute(XElement element, string attributeName)
        {
            XAttribute a = GetAttribute(element, attributeName);

            decimal result;

            if (!decimal.TryParse(a.Value, out result))
            {
                throw new InvalidOperationException(string.Format("Decimal not found in attribute {0} on element {1}.", attributeName, element.Name));
            }

            return result;
        }

Same methods

XElementExtensions::SafeGetDecimalFromAttribute ( System.Xml.Linq.XElement element, string elementName, string attributeName ) : decimal