4 using System.Collections;
5 using System.Collections.Generic;
10 using XPI = System.Xml.XLinq.XProcessingInstruction;
13 namespace System.Xml.XLinq
15 public class XAttribute
17 static IEnumerable <XAttribute> emptySequence =
18 new List <XAttribute> ();
20 public static IEnumerable <XAttribute> EmptySequence {
21 get { return emptySequence; }
28 public XAttribute (XAttribute source)
34 public XAttribute (XName name, object value)
37 this.value = XUtil.ToString (value);
44 public XElement Parent {
45 get { return parent; }
48 value.InternalAppendAttribute (this);
53 get { return XUtil.ToString (value); }
54 set { this.value = value; }
57 public override bool Equals (object obj)
59 XAttribute a = obj as XAttribute;
62 return a.Name == name && a.value == value;
65 public override int GetHashCode ()
67 return name.GetHashCode () ^ value.GetHashCode ();
70 public static explicit operator bool (XAttribute a)
72 return XUtil.ToBoolean (a.value);
75 public static explicit operator Nullable <bool> (XAttribute a)
77 return a.value == null || String.Empty == a.value as string ?
78 null : XUtil.ToNullableBoolean (a.value);
81 // FIXME: similar conversion methods follow.
86 parent.InternalRemoveAttribute (this);