Merge pull request #225 from mistoll/master
[mono.git] / mcs / class / System.XML / System.Xml.Serialization / XmlAttributes.cs
index eddc9b0c3bdb72e9c1551b7deb6102ed0bf93a1a..17d5233e098d903a83cdf9e4f890e68a3365872f 100644 (file)
@@ -40,7 +40,9 @@ namespace System.Xml.Serialization
        /// </summary>
        public class XmlAttributes
        {
+#if !MOONLIGHT
                private XmlAnyAttributeAttribute xmlAnyAttribute;
+#endif
                private XmlAnyElementAttributes xmlAnyElements = new XmlAnyElementAttributes();
                private XmlArrayAttribute xmlArray;
                private XmlArrayItemAttributes xmlArrayItems = new XmlArrayItemAttributes();
@@ -64,9 +66,12 @@ namespace System.Xml.Serialization
                        object[] attributes = provider.GetCustomAttributes(false);
                        foreach(object obj in attributes)
                        {
+#if !MOONLIGHT
                                if(obj is XmlAnyAttributeAttribute)
                                        xmlAnyAttribute = (XmlAnyAttributeAttribute) obj;
-                               else if(obj is XmlAnyElementAttribute)
+                               else
+#endif
+                               if(obj is XmlAnyElementAttribute)
                                        xmlAnyElements.Add((XmlAnyElementAttribute) obj);
                                else if(obj is XmlArrayAttribute)
                                        xmlArray = (XmlArrayAttribute) obj;
@@ -96,6 +101,7 @@ namespace System.Xml.Serialization
                }
 
                #region public properties
+#if !MOONLIGHT
                public XmlAnyAttributeAttribute XmlAnyAttribute 
                {
                        get 
@@ -107,6 +113,7 @@ namespace System.Xml.Serialization
                                xmlAnyAttribute = value;
                        }
                }
+#endif
                public XmlAnyElementAttributes XmlAnyElements 
                {
                        get 
@@ -241,7 +248,9 @@ namespace System.Xml.Serialization
                        
                        KeyHelper.AddField (sb, 1, xmlIgnore);
                        KeyHelper.AddField (sb, 2, xmlns);
+#if !MOONLIGHT
                        KeyHelper.AddField (sb, 3, xmlAnyAttribute!=null);
+#endif
 
                        xmlAnyElements.AddKeyHash (sb);
                        xmlArrayItems.AddKeyHash (sb);
@@ -278,5 +287,22 @@ namespace System.Xml.Serialization
                                
                        sb.Append ("|");
                }
+
+               internal int? Order {
+                       get {
+                               int? order = null;
+                               if (XmlElements.Count > 0)
+                                       order = XmlElements.Order;
+                               else if (XmlArray != null)
+                                       order = XmlArray.Order;
+                               else if (XmlAnyElements.Count > 0)
+                                       order = XmlAnyElements.Order;
+                               return order;
+                       }
+               }
+               
+               internal int SortableOrder {
+                       get { return Order != null ? (int) Order : int.MinValue; }
+               }
        }
 }