public static int GetAttributeAsInt32(this XElement element, string name) { var text = element.GetAttribute(name); if (string.IsNullOrEmpty(text) == true) { return(0); } return(CremaXmlConvert.ToInt32(text)); }
public static int GetAttributeAsInt32(this XmlReader reader, string name) { var text = reader.GetAttribute(name); if (string.IsNullOrEmpty(text) == true) { return(0); } return(CremaXmlConvert.ToInt32(text)); }
public static bool TryGetAttributeAsInt32(this XmlReader reader, string name, out int value) { var text = reader.GetAttribute(name); if (string.IsNullOrEmpty(text) == true) { value = 0; return(false); } value = CremaXmlConvert.ToInt32(text); return(true); }