public static string GetStringValue(this XElement element, string attribute = null, string defaultValue = "")
{
if (element == null)
return defaultValue;
if (string.IsNullOrEmpty(attribute))
return element.Value;
var xatt = element.Attribute(attribute);
return xatt?.Value ?? defaultValue;
}
public static int? GetIntValue(this XElement element, string attribute = null, int? defaultValue = null)