예제 #1
0
 // values
 public static string Value(this xElement element)
 {
     if (element == null)
     {
         return(null);
     }
     return(element.Value);
 }
예제 #2
0
 // names
 public static string Name(this xElement element)
 {
     if (element == null)
     {
         return(null);
     }
     return(element.Name);
 }
예제 #3
0
파일: element.cs 프로젝트: arookas/arookas
        internal static T Convert <T>(xElement element, TryParse <T> parser, T defaultValue)
        {
            T value;

            if (element != null && parser(element.Value, out value))
            {
                return(value);
            }
            return(defaultValue);
        }
예제 #4
0
        public static xAttributes Attributes(this xElement element)
        {
            if (element == null)
            {
                return(sEmptyAttributes);
            }
            var attributes = element.XElement.Attributes();

            return(new xAttributes(attributes.Select(i => new xAttribute(element._Document, element, i))));
        }
예제 #5
0
        public static TEnum AsEnum <TEnum>(this xElement element, TEnum defaultValue)
            where TEnum : struct
        {
            TEnum value;

            if (element != null && Enum.TryParse(element.Value, true, out value))
            {
                return(value);
            }
            return(defaultValue);
        }
예제 #6
0
        public static xAttributes Attributes(this xElement element, string name)
        {
            aError.CheckNull(name, "name");
            if (element == null)
            {
                return(sEmptyAttributes);
            }
            var attributes = element.XElement.Attributes(name);

            return(new xAttributes(attributes.Select(i => new xAttribute(element._Document, element, i))));
        }
예제 #7
0
        // attributes
        public static xAttribute Attribute(this xElement element, string name)
        {
            if (element == null)
            {
                return(null);
            }
            if (!element.HasAttributes)
            {
                return(null);
            }
            var attribute = element.XElement.Attribute(name);

            if (attribute == null)
            {
                return(null);
            }
            return(new xAttribute(element._Document, element, attribute));
        }
예제 #8
0
파일: object.cs 프로젝트: arookas/arookas
 internal xObject(xDocument document, xElement parent)
 {
     mDocument = document;
     mParent   = parent;
 }
예제 #9
0
파일: element.cs 프로젝트: arookas/arookas
 internal xElement(xDocument document, xElement parent, XElement element)
     : base(document, parent, element)
 {
     mElement = element;
 }
예제 #10
0
 // explicit casts
 public static TEnum AsEnum <TEnum>(this xElement element)
     where TEnum : struct
 {
     return(AsEnum(element, default(TEnum)));
 }
예제 #11
0
 internal xAttribute(xDocument document, xElement parent, XAttribute attribute)
     : base(document, parent)
 {
     aError.CheckNull(attribute, "attribute");
     mAttribute = attribute;
 }