public static class XElementExtension
{
public static double GetDouble(this XElement element)
{
double value = 0d;
if (element != null)
double.TryParse(element.Value, out value);
return value;
}
public static string GetString(this XElement element)
{
string value = string.Empty;
if (element != null)
{
value = element.Value;
}
return value;
}
public static bool GetBool(this XElement element)
{
bool value = false;
if (element != null)
{
if (element.Value == "1")
{
value = true;
}
}
return value;
}
public static int GetInt(this XElement element)
{
int value = 0;
if (element != null)
int.TryParse(element.Value, out value);
return value;
}
}