public static SafeGetDecimalFromAttribute ( System.Xml.Linq.XElement element, string attributeName ) : decimal | ||
element | System.Xml.Linq.XElement | |
attributeName | string | |
return | 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;
}
XElementExtensions::SafeGetDecimalFromAttribute ( System.Xml.Linq.XElement element, string elementName, string attributeName ) : decimal |