예제 #1
0
        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));
        }
예제 #2
0
        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));
        }
예제 #3
0
        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);
        }